bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/j


From: i at maskray dot me
Subject: [Bug gas/27169] i386: Emit R_386_PLT32 instead of R_386_PC32 for `call/jmp foo`
Date: Wed, 13 Jan 2021 03:11:00 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27169

--- Comment #10 from Fangrui Song <i at maskray dot me> ---
(In reply to H.J. Lu from comment #9)
> ld uses R_386_PC32 to tell if call site supports PIC PLT.  Calling an IFUNC
> function in static PIE requires PLT. If call site doesn't support PIC PLT,
> linker will issue an error:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=20515

Let me rephrase what PR20515 is about:

For a call to a hidden function declaration, the compiler produces an
R_386_PC32 relocation. The relocation is an indicator that EBX may not be set
up.

If the declaration refers to an ifunc definition, the linker will resolve the
R_386_PC32 to an IPLT entry. For -pie and -shared links, the IPLT entry
references EBX. If the call site does not set up EBX, the IPLT entry call will
be incorrect.

The resolution to PR20515 has implemented the diagnostic. If we change the
compiler/assembler to use R_386_PLT32 for non-default visibility function
declarations, this diagnostic will be lost.

So unfortunately we cannot find a satisfactory relocation type for branches to
undefined symbols:

* R_386_PC32: canonical PLT entries (similar to copy relocations) which may
break -Bsymbolic or --dynamic-list usage.
* R_386_PLT32: lose a diagnostic for non-default ifunc in -pie/-shared modules.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]