This is the mail archive of the
mailing list for the GCC project.
Re: [x86-64-psABI] RFC: Add R_X86_64_RELAX_PC32 and R_X86_64_RELAX_PLT32
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: "x86-64-abi at googlegroups dot com" <x86-64-abi at googlegroups dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 12 May 2015 11:42:01 -0700
- Subject: Re: [x86-64-psABI] RFC: Add R_X86_64_RELAX_PC32 and R_X86_64_RELAX_PLT32
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOp9tv1bnUPJ6s=NR7=5srs48Vqn5-L0Te9agSNSUTyrkw at mail dot gmail dot com> <alpine dot LSU dot 2 dot 20 dot 1505111744400 dot 4883 at wotan dot suse dot de> <CAMe9rOqcLsgDsqFU5mOnA6fQ+wRsNwCpJLiRYDKS1mhcdqfyoA at mail dot gmail dot com>
On Mon, May 11, 2015 at 8:52 AM, H.J. Lu <email@example.com> wrote:
> I will clarify in the spec language. Yes, that is the intention for both
> R_X86_64_RELAX_PC32 and R_X86_64_RELAX_PLT32. That is what
> is implemented on users/hjl/relax branch.
Here is the updated proposal. I changed nop prefix from 0x48
to 0x67 and clarified how foo@GOTPCREL(%rip) should be
To remove one direct branch to PLT for external function calls:
I am proposing to add 2 new relocations, R_X86_64_RELAX_PC32 and
1. They can only be used on 32-bit direct call/jmp instructions.
2. call/jmp instructions must have a 0x67 prefix, which is the address
size prefix and is ignored by 32-bit direct call/jmp instructions.
3. Linker can treat them as R_X86_64_PC32 and R_X86_64_PLT32, respectively.
4. Optionally, linker can convert
0x67 call/jmp foo[@PLT]
when function foo is defined in a shared library. If there is no GOT
slot allocated for symbol foo, linker should resolve foo@GOTPCREL(%rip)
to its PLT slot address + 6, which is the push instruction, to support
lazy binding. Otherwise, linker should resolve it to its PLT slot
If foo is defined locally, linker will generate
0x67 call/jmp foo
R_X86_64_RELAX_PC32 is defined as 39, which was the deprecated
bnd call/jmp foo
R_X86_64_RELAX_PLT32 is defined as 40, which was the deprecated
bnd call/jmp foo@PLT
Since the current linkers treat R_X86_64_PC32_BND and R_X86_64_PLT32_BND
as R_X86_64_PC32 and R_X86_64_PLT32, respectively, they can handle the
new ones correctly.