]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
x86: Treat protected symbols with indirect external access as local
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 8 Aug 2025 01:04:47 +0000 (18:04 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 9 Aug 2025 15:56:43 +0000 (08:56 -0700)
commitff3b64d944d711a306232928ebd3d049a8c70d65
tree41905b8d89e031733981e86093d7ecdb6f232d87
parenta65d0a432567c62618fc83b9d9647e4868d6f08d
x86: Treat protected symbols with indirect external access as local

If all external symbol accesses are indirect, we can treat protected
symbols as local since there will be no copy relocation for data and
external function pointer access will go through GOT, instead of PLT.
No PLT slot should be used for external function pointer in executable.

bfd/

PR ld/33260
* elfxx-x86.h (COPY_INPUT_RELOC_P): Treat protected symbols with
indirect external access as local.

ld/

PR ld/33260
* testsuite/ld-i386/i386.exp: Run PR ld/33260 test.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr33260.d: New file.
* testsuite/ld-i386/pr33260.s: Likewise.
* testsuite/ld-x86-64/pr33260-x32.d: Likewise.
* testsuite/ld-x86-64/pr33260.d: Likewise.
* testsuite/ld-x86-64/pr33260.s: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elfxx-x86.h
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/pr33260.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr33260.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr33260-x32.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr33260.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr33260.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp