All Questions
Tagged with relocation ld
13 questions
1
vote
0
answers
411
views
LLVM: object file relocation truncated to fit: R_X86_64_32S against `.rodata'
I have an LLVM program that evaluates instructions and builds IR. I then emit the module using LLVMTargetMachineEmitToFile. When linking with ld I get an outut of:
test:(.text+0x61): relocation ...
2
votes
2
answers
4k
views
relocation truncated to fit r_386_8 against .bss'
When I try to build my source into a 32-bit static executable for Linux with
nasm -f elf -F dwarf -g loop.asm
ld -m elf_i386 -o loop loop.o
I get this R_386_8 error, any idea what causes it?
foo.o: ...
3
votes
1
answer
1k
views
Using .reloc from assembly
This is a cut-down version of the problem I'm facing on AArch64:
I've this macro that keeps dumping some data into a section.
#define GEN_DATA(_type) \
.pushsection .mydata_##_type, "aw"; \
....
2
votes
1
answer
403
views
What is the difference between PIC code and `ld -r`?
I know both are used to make code that can be placed in different locations, but how does each work, and why?
9
votes
1
answer
924
views
Resolve relative relocations in partial link
I've noticed that using -r to do a partial link doesn't actually resolve any relocations, it seems, even if they could be resolved via relative addressing. For example, consider f.o and g.o, with f.o ...
2
votes
1
answer
546
views
Moving the ELF64 relocation table
I'm attempting to move the .rela.plt relocation table of a shared object to the end of the file (Because I'm going to add new relocation entries in the future).
First, I read all entries in the .rela....
5
votes
1
answer
4k
views
What is absolute symbol and how to define it in C?
In the man page of nm. It says
“A” The symbol's value is absolute, and will not be changed by further linking.
However, I don't know what that means. How can I define a variable or something else ...
1
vote
2
answers
665
views
What does "relocation illegal when not bound to object being created" mean?
I am trying to build Apache Qpid on a SPARC running Solaris 10. By now libqpidtypes.so builds, but libqpidcommon.so does not link.
After compilation the linker creates a lot of error messages like ...
3
votes
2
answers
2k
views
Xtensa --- dangerous relocation: windowed long call crosses 1GB boundary
I got the following error during compilation
(.sram.text+0x1283): dangerous relocation: windowed longcall crosses
1GB boundary; return may fail: (UND+0xdeadcafe)
in one of the functions.
The ...
1
vote
2
answers
435
views
How does the linker determine at which line a symbol is called?
I want to know, how the linker determines that printf is called @ 0xd1:
If I look into the symbol table for the address of _printf I see it's 0x0, because this function is not already relocated. But ...
1
vote
2
answers
2k
views
GNU linker (ld) generates static relocations in shared library
If I compile the example code at the bottom with
arm-elf-gcc init.c -o lib.so -Wl,-shared -nostdlib
I get a shared library with some relocations (readelf lib.so -r):
0000032c 00000d02 R_ARM_ABS32 ...
2
votes
1
answer
2k
views
Using GNU ld, how can I force the address of a specific (external) symbol without getting a "relocation truncated" error?
I have two functions, a() and b(), that both have specific, fixed load/run-time addresses. I am compiling a() myself, while b() is already provided (e.g. in ROM).
The file a.c is as follows:
extern ...
6
votes
2
answers
8k
views
Why does the -r option (relocatable) make ld not find any libraries?
Running Debian/Linux x86_64 with GNU ld 2.21.
Quite simply, if I link with
ld -o main main.o /usr/lib/crti.o /usr/lib/crt1.o /usr/lib/crtn.o -lc -lm
It works, but when I link with
ld -r -o main1.o ...