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

--- Comment #6 from Fangrui Song <maskray at sourceware dot org> ---
We should revisit the resolution to PR25551 and PR32196.

I raised PR25551 due to an unneeded .symtab entry .Lprintk$local .
The resolution changed R_X86_64_PLT32 to R_X86_64_PC32, which is less
desirable, and required an amendment for this issue.

PLT32 is a branch relocation type, which means the symbol address is
insignificant (similar to R_AARCH64_CALL26 / R_PPC64_REL24).
In a modified large code model, we could instruct the linker to create a range
extension thunk if the target symbol is out of reach of +-2GiB.

        .section        .init.text,"ax",@progbits
        call    .Lprintk$local
                                        # -- End function
        .text
        .globl  printk                  # -- Begin function printk
        .type   printk,@function
printk:                                 # @printk
.Lprintk$local:
 ret

Using PC32 means the symbol address is significant, and we cannot safely
redirect the relocation (without disassembling the instruction) to a thunk.

For this assembly sequence, LLVM integrated assembler generates the desired
R_X86_64_PLT32 relocation referencing .text - 4, which allows range extension
thunks.


(Meta Platforms engineers want to implement range extension thunks for
https://groups.google.com/g/x86-64-abi/c/RsJDf06xMJ0
I mentioned that "we should have at least some basic agreement on x86-64-abi
(gitlab.com/x86-psABIs/x86-64-ABI) before moving in this direction - and I
recalled this gas issue.)

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

Reply via email to