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
1
vote
0 answers

lld-link error: undefined symbol: __sbsan_handle_out_of_bounds

I'm trying to test clang's -fsanitize=array-bounds compiler flag with some c99 code on Windows but I can't compile due to a linker error. My test code is this: int index = 11; int arr[10] = { 0 }; arr[index] = 33; And when I compile I get this…
Jason
  • 2,198
  • 3
  • 23
  • 59
1
vote
2 answers

ld.lld: error: undefined symbol: __divdi3

I'm trying to link two risc-v elf files together with ld.lld, but ld.lld is giving me the following error: ld.lld: error: undefined symbol: __divdi3 I suppose that I need to link my files with some helper functions, but after looking for it in my…
Cyao
  • 727
  • 4
  • 18
1
vote
2 answers

Detect when linking a binary has finished by looking at just the executable?

The build tool for the language in which our project is written does compilation and linking in parallel, for a number of different binaries and so on. In CI we have a separate thread that looks for these compiled binaries as they become available…
jberryman
  • 16,334
  • 5
  • 42
  • 83
1
vote
1 answer

Adding a new LLVM target to llvmlite

Is it possible to add a new target to llvmlite (python library)? For a new hardware (e.g. ASIC), I need to have a new and custom LLVM target. This is not very clear from the documentation. If it is not possible to add a new target in llvmlite, can I…
Roy
  • 65
  • 2
  • 15
  • 40
1
vote
1 answer

argument unused during compilation: '-fuse-ld=lld'

I have successfully built clang and lld from source, and both are now available under my .../llvm-project/build/bin directory. Following lld documentation, I am now trying to pass -fuse-ld=lld command line directive to clang to force it to use lld…
Farzam
  • 131
  • 2
  • 13
1
vote
1 answer

llvm linker(lld) mapfile format explanation

I want to parse the lld mapfile. Is there an explanation or documentation? I checked clang documentation and lld documentation but failed to find helpful infomation. Here is an example of my mapfile VMA LMA Size Align…
Heyi Sun
  • 11
  • 3
1
vote
1 answer

Accessing `__heap_base` when building a `.wasm` binary with Rust

Wanted to follow what it is done in this article: https://surma.dev/things/c-to-webassembly/ but with Rust and write a custom allocator. For that I would need to access __heap_base variable that llvm adds as a pointer of where the heap starts in…
1
vote
0 answers

is there an environment variable I can passs to cmake that will make clang use lld and not ld?

is there an environment variable I can passs to cmake that will make clang use lld and not ld? I want something that I can use with CC and CXX and will accomplish the same thing as fuse-ld=lld.
Edward
  • 468
  • 4
  • 18
1
vote
0 answers

Why gcc linker instead of ld.lld is invoked when target is specified in clang command?

Helllo, On my WSL2 ubuntu 20.04 system, when I use the following command to invoke ld.lld, everything is OK: clang -fuse-ld=/usr/local/bin/ld.lld .... But when the option "--target=aarch64" is added, it will invoke gcc. clang…
simon
  • 23
  • 4
1
vote
0 answers

LLVM IR directly to a shared binary file (without any intermediate files)

I'm wondering if there is a way to go directly from LLVM IR (contained in a cpp program, i.e. in memory) to a shared binary? I'm looking for a way that does not create any intermediate files on disk except the end result, i.e. the shared binary. Is…
Christian Winther
  • 1,113
  • 1
  • 9
  • 17
1
vote
1 answer

Clang linker does not recognise Linux libraries

I am close to being able to cross compile binaries for Linux on Windows. I have got a command that will compile my code to a .o file, but I am unable to get it to link to produce the binary. Right now it is saying that it can't link to several…
1
vote
0 answers

How to fix rust-lld error SBREL relocation to xxx without static base with rwpi relocation model?

For research purpose, I'm trying to build an image for my cortex-m4 microcontroller with rwpi relocation model. However, during linking stage, lld throws me the error: rust-lld: error: SBREL relocation to __sbss without static base Below is an easy…
Zhiyao
  • 4,152
  • 2
  • 12
  • 21
1
vote
0 answers

LLD vs LD Linker Script Discrepancy

I'm moving a project from LD to LLD. An error has cropped up which appears due to the lack of global expression support in LLD. Are variables supported like this? An simplified example of something that works in LD: example.ld _Flash_Origin =…
David Ledger
  • 2,033
  • 1
  • 12
  • 27
1
vote
1 answer

Are there any C++ APIs for lld?

Currently I am implementing a compiler for my programming language. So my compiler compiles source files to .o object files, and since I want my programming language to have access to C functions like printf, I need link the .o file to libc. To be…
tjysdsg
  • 656
  • 8
  • 19
1
vote
1 answer

lld-link error: no input files when trying to link with libcmt.lib on Windows10

I'm compiling a very simple main.c: int myfunc(int x, int y){ return x + y; } int main(){ int res = myfunc(2,2); return; } I am compiling with the following options: clang.exe -std=c11 -g -c .\main.c I get my main.o as the output.…
mbl
  • 805
  • 11
  • 18