This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[x86-64-psABI] RFC: Add R_X86_64_RELAX_PC32 and R_X86_64_RELAX_PLT32


To remove one direct branch to PLT for external function calls:

https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00001.html

I am proposing to add 2 new relocations, R_X86_64_RELAX_PC32
and R_X86_64_RELAX_PLT32:

1. They can only be used on 32-bit PC relative call/jmp instructions.
2. call/jmp instructions must have a 0x48 prefix.
3. Linker can treat them as R_X86_64_PC32 and R_X86_64_PLT32,
respectively.
4. Optionally, linker can convert

0x48 call/jmp foo[@PLT]

to

call/jmp *foo@GOTPCREL(%rip)

when function foo is undefined.

R_X86_64_RELAX_PC32 is defined as 39, which was the
deprecated R_X86_64_PC32_BND for

bnd call/jmp  foo

R_X86_64_RELAX_PLT32 is defined as 40, which was the
deprecated R_X86_64_PLT32_BND for

bnd call/jmp  foo@PLT

Since the current linkers treat R_X86_64_PC32_BND and
R_X86_64_PLT32_BND as _X86_64_PC32 and R_X86_64_PLT32,
respectively, they can handle the new ones correctly.

Comments, suggestions?

Thanks.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]