You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.
Relocation section '.reloc.foo' at offset 0x15b contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
000000000030 000400000002 R_X86_64_PC32 0000000000000000 bar + 0
When I compile an equivalent(ish) test.c with clang:
extern int bar();
void foo(int arg, int arg1) {
if (arg < 4 || arg1 == 0) {
bar();
}
}
I get the following relocation type:
Relocation section '.rela.text' at offset 0x128 contains 1 entries:
Offset Info Type Sym. Value Sym. Name + Addend
00000000000d 000300000004 R_X86_64_PLT32 0000000000000000 bar - 4
The text was updated successfully, but these errors were encountered:
The correct relocation depends on how the code will be used. If the code is going to be included in a shared library, it's desirable to avoid patching the code at startup time, so it wants the PLT32 relocation, which creates a procedure-linkage-table (PLT) entry, which is a level of indirection that allows for address patching without modifying the main code of the library. However use of the PLT has some overhead, so when a PLT isn't needed, a PC32 relocation is preferred, which just patches in the pc-relative offset of the callee into the call instruction so that it calls the callee directly.
I wouldn't be surprised if somewhere between cretonne, llvm2cretonne, and faerie, we don't consider all these details yet.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm a complete novice when it comes to relocations.
Working with
test.ll
:I get the following relocation type:
When I compile an equivalent(ish)
test.c
with clang:I get the following relocation type:
The text was updated successfully, but these errors were encountered: