bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/17644] New: Optimize out i386/x86-64 JUMP_SLOT relocation


From: hjl.tools at gmail dot com
Subject: [Bug gold/17644] New: Optimize out i386/x86-64 JUMP_SLOT relocation
Date: Tue, 25 Nov 2014 13:10:24 +0000

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

            Bug ID: 17644
           Summary: Optimize out i386/x86-64 JUMP_SLOT relocation
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at google dot com
          Reporter: hjl.tools at gmail dot com
                CC: ian at airs dot com

When there are both PLT and GOT references to the same function symbol,
linker will create a GOTPLT slot for PLT entry and a GOT slot for GOT
reference.  A run-time JUMP_SLOT relocation is created to update the
GOTPLT slot and a run-time GLOB_DAT relocation is created to update the
GOT slot.  Both JUMP_SLOT and GLOB_DAT relocations will apply the same
symbol value to GOTPLT and GOT slots, respectively, at run-time.

This optimization combines GOTPLT and GOT slots into a single GOT slot
and removes the run-time JUMP_SLOT relocation.  It replaces the regular
PLT entry:

indirect jump    [GOTPLT slot]
push    relocation index
jump    PLT0

with an GOT PLT entry with an indirect jump via the GOT slot:

indirect jump    [GOT slot]
nop

and resolves PLT reference to the GOT PLT entry.

We must avoid this optimization if pointer equality is needed since
we don't clear symbol value in this case and the dynamic linker won't
update the GOT slot.  Otherwise, the resulting binary will get into an
infinite loop at run-time.

This is implemented in bfd linker with

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=dd7e64d45b317128f5fe813a8da0b13b4ad046ae

-- 
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]