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

--- Comment #6 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jens Remus <[email protected]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c1011a70b07560a1c4e42cab7c5156d1f594816a

commit c1011a70b07560a1c4e42cab7c5156d1f594816a
Author: Jens Remus <[email protected]>
Date:   Fri Nov 7 17:09:55 2025 +0100

    s390: Bind defined symbol locally in PIE

    Symbols defined in PIE should be bound locally, the same as -shared
    -Bsymbolic.

    Port x86 commit 4e0c91e45402 ("Bind defined symbol locally in PIE")
    change of relocate_section as well as linker tests to s390.  Similar as
    done for other architectures with the following commits:
    - AArch64: ac33b731d214 ("[AArch64] Bind defined symbol locally in PIE")
    - ARM: 1dcb9720d62c ("[ARM] Bind defined symbol locally in PIE")
    - RISC-V: 39c7793ba8be ("RISC-V: Bind defined symbol locally in PIE")
    - x86: 4e0c91e45402 ("Bind defined symbol locally in PIE")
    With this change symbols defined in an executable (i.e. PDE or PIE) are
    bound locally, as they cannot be interposed.  In the same way as symbols
    defined in a shared library linked with -Bsymbolic are bound locally.

    This also ensures that all defined symbols are bound locally in
    static PIE.

    Do not port the x86 change of check_relocs (now scan_relocs).  None of
    the linker tests where the change in condition triggers (e.g. bootstrap,
    cdtest) produce different readelf -Wa output.  The change appears to
    affect accounting of space required for dynamic relocations.  Instead of
    accounting them in check_relocs and later filtering them away in
    allocate_dynrelocs, they would not get accounted in the first place:
    The change in the expression would only have an effect if the following
    conditions are all met in addition to PIE:  ALLOC, PC-relative
    relocation, global symbol, not defined weak, and defined regular.  In
    this specific case the accounting of the PC relative relocation in
    h->dyn_relocs would be skipped for PIE.  But allocate_dynrelocs later
    eliminates any PC-relative dynamic relocations if PIC (= PIE or shared
    library) and SYMBOL_CALLS_LOCAL.

    bfd/
            PR ld/33141
            * elf64-s390.c (elf_s390_relocate_section): Bind defined symbol
            locally in PIE.

    ld/testsuite/
            PR ld/33141
            * ld-s390/s390.exp: Add pr33141 tests.
            * ld-s390/pr33141.rd: New file.
            * ld-s390/pr33141a.s: Likewise.
            * ld-s390/pr33141b.s: Likewise.

    Signed-off-by: Jens Remus <[email protected]>

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

Reply via email to