Skip to content

Compilation fails if using lld #63

Description

@TheRawMeatball

In my ~/.cargo/config.toml, I have the following entry:

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-Clink-arg=-fuse-ld=lld"]

to improve link times and iteration speed. However, this seems to break linkme compilation, badly.

Here's a snippet from the error message during compilation:

  = note: ld.lld: error: undefined symbol: __start_linkme_BENCHMARKS                                                                                                                                                                                                                                                  
          >>> referenced by 29qlfu0bgl5pi1ii                                                                                                                                                                                                                                                                          
          >>>               /home/meatball/coding/linkme/target/debug/deps/example-d6ac051010cd24ec.29qlfu0bgl5pi1ii.rcgu.o:(example::BENCHMARKS::h84fb1b0801cd0cb3)                                                                                                                                                  
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                      
          ld.lld: error: undefined symbol: __stop_linkme_BENCHMARKS                                                                                                                                                                                                                                                   
          >>> referenced by 29qlfu0bgl5pi1ii                                                                                                                                                                                                                                                                          
          >>>               /home/meatball/coding/linkme/target/debug/deps/example-d6ac051010cd24ec.29qlfu0bgl5pi1ii.rcgu.o:(example::BENCHMARKS::h84fb1b0801cd0cb3)                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                      
          ld.lld: error: undefined symbol: __start_linkm2_BENCHMARKS                                                                                                                                                                                                                                                  
          >>> referenced by 29qlfu0bgl5pi1ii                                                                                                                                                                                                                                                                          
          >>>               /home/meatball/coding/linkme/target/debug/deps/example-d6ac051010cd24ec.29qlfu0bgl5pi1ii.rcgu.o:(example::BENCHMARKS::h84fb1b0801cd0cb3)                                                                                                                                                  
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                      
          ld.lld: error: undefined symbol: __stop_linkm2_BENCHMARKS                                                                                                                                                                                                                                                   
          >>> referenced by 29qlfu0bgl5pi1ii                                                                                                                                                                                                                                                                          
          >>>               /home/meatball/coding/linkme/target/debug/deps/example-d6ac051010cd24ec.29qlfu0bgl5pi1ii.rcgu.o:(example::BENCHMARKS::h84fb1b0801cd0cb3)                                                                                                                                                  
          clang-14: error: linker command failed with exit code 1 (use -v to see invocation)                                                                                                                                                                                                                          

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions