Questions tagged [lld]

lld is the linker from LLVM.

lld is the linker from the LLVM project. It is modular, fast and compatible with existing linker options.

109 questions
53
votes
2 answers

What's the difference between `-rpath-link` and `-L`?

The man for gold states: -L DIR, --library-path DIR Add directory to search path --rpath-link DIR Add DIR to link time shared library search path The man for bfd ld makes it sort of sound like -rpath-link is used for…
lanza
  • 1,512
  • 2
  • 13
  • 26
37
votes
3 answers

How do I change the default rustc / Cargo linker?

I would like to make rustc use lld as a linker instead of ld in a particular crate. So I create .cargo/config in my project directory with the following: [target.x86_64-unknown-linux-gnu] …
kreo
  • 2,613
  • 2
  • 19
  • 31
28
votes
3 answers

Is the lld linker a drop-in replacement for ld and gold?

The linker from the LLVM project lld is currently developed with new features added week by week. Its developers promise that lld is faster than ld. How does it compete compared to gold? Is lld a drop-in replacement for ld? With gold there are some…
usr1234567
  • 21,601
  • 16
  • 108
  • 128
13
votes
2 answers

Complete and isolated LLVM/musl toolchain

What I'm trying to achieve is to compile an GNU independent and isolated LLVM toolchain using musl as clib. Recently LLVM 4.0 has been released with lot's of new cool features, including production ready LLD, so also the linking step could be…
Stefano Azzalini
  • 1,027
  • 12
  • 21
11
votes
2 answers

LLD - unknown argument: -arch

Trying to link a simple program using LLVM 4.0.0 release (Clang, LLD) on Mac OS Sierra. Note, this is fully achievable in Linux. My current path is prefixed with the LLVM's bin directory (i.e. /opt/LLVM/4.0.0/bin:$PATH. The program (main.cpp) is the…
juniel_katarn
  • 330
  • 4
  • 11
10
votes
1 answer

How to use lld with CMake on Windows?

I'm trying to compile SDL2 (https://www.libsdl.org/download-2.0.php) using CMake with clang + lld (http://releases.llvm.org/) + mingw (https://sourceforge.net/projects/mingw-w64/) headers on Windows 10. Despite my many efforts, I seem unable to get…
7
votes
2 answers

Using -fuse-ld=lld with Clang on macOS

I am using Clang 10 (not AppleClang) on macOS 10.15 and am trying to link with LLD by specifying -fuse-ld=lld in the CMake flags CMAKE_EXE_LINKER_FLAGS. However, I am getting the following error when I try to use LLD: The C++…
keith
  • 5,122
  • 3
  • 21
  • 50
7
votes
2 answers

lld undefined symbol: mainCRTStartup

My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link…
J.Doe
  • 83
  • 1
  • 5
6
votes
1 answer

Does LTO works when compiling with GCC but linking with LLVM LLD?

I recently discovered the LLVM's linker, lld that was praised for very fast linking. Indeed, I tested it and the results were awesome, the linking time in my case being reduced dramatically comparing to gold. However, when speaking about link-time…
Sebi
  • 428
  • 5
  • 11
6
votes
3 answers

Linking static libraries with clang independent of order

In GCC, I can use the linker flags -Wl,--start-group and -Wl,--end-group to resolve linking problems with libraries that have circular dependencies. I'd like to do the same with clang, but it seems like this feature was dropped in lld version 3.2.…
Mokosha
  • 2,737
  • 16
  • 33
5
votes
1 answer

lld runs LTO even if -fno-lto is passed

I have a CMake project with several subprojects that create static libraries built with -flto=thin. The project has a lot of tests that are linked against the aforementioned libraries. With LTO it takes a lot of time to build tests, therefore I have…
Simone Rondelli
  • 356
  • 1
  • 18
5
votes
0 answers

Extracting LLVM bitcode embedded using `-lto-embed-bitcode`

Goal: Extract full-program (merged) post-LTO bitcode from an ELF binary. The program happens to be written in Rust, but I don't think that's a crucial detail. I'm able to compile a Rust program into an ELF binary with a .llvmbc section using the…
Edd Barrett
  • 3,425
  • 2
  • 29
  • 48
5
votes
1 answer

Linking with LLVM LLD does not work [macos]

The following compile command with clang6.0: LDFLAGS="-L/usr/local/opt/myllvm6.0rc1/lib -fuse-ld=lld" CPPFLAGS="-I/usr/local/opt/myllvm6.0rc1/include -I/usr/local/opt/myllvm6.0rc1/include/c++/v1/"; clang++ -fsanitize=address $LDFLAGS $CPPFLAGS -g…
Gabriel
  • 8,990
  • 6
  • 57
  • 101
5
votes
0 answers

LLVM LD option "-rpath-link"

When using the GNU LD for Linux to link some C code using the "-rpath-link" option it works well and as expected. However, when using the LLVM LD version 3.7.1 for Mac OS X to link the same C code using the "-rpath-link" option, LD gives an error…
user7698505
4
votes
1 answer

Stack build fails with LLD errors

I'm trying to build some Haskell packages with stack (haskell-ide-engine and hlint specifically), but they both fail with many ld.lld error messages, all related to R_X86_64_32S relocation, e.g.: ld.lld: error: can't create dynamic relocation…
Kasra Ferdowsi
  • 574
  • 5
  • 16
1
2 3 4 5 6 7 8