]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
elf: Don't set its DT_VERSYM entry for unversioned symbol
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 29 Oct 2025 01:49:57 +0000 (09:49 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Mon, 3 Nov 2025 07:09:07 +0000 (15:09 +0800)
commitf685e3953f9a38a41bbd0a597f9882870cee13d5
tree98bae47529719eaa36b210e801911307c3e5357b
parent603d5fa176dd05d713dc21ea77ce7a5cbdd9770a
elf: Don't set its DT_VERSYM entry for unversioned symbol

1. Referenced symbol without '@' has no version.
2. Defined symbol without the .symver directive has no version if there
is no linker version script.

Symbol without version shouldn't have the base version in its DT_VERSYM
entry.  Instead, its DT_VERSYM entry should be all zero to indicate that
the symbol doesn't have a version.

NB: Symbol with the base version has a '@' suffix, like "foo@", defined
with

.symver hide_original_foo, foo@

bfd/

PR ld/33577
* elflink.c (elf_link_output_extsym): Don't set its DT_VERSYM
entry for the symbol without version.

ld/

PR ld/33577
* ld-elfvers/vers16.dsym: Remove the "Base" version on symbols
without version.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elflink.c
ld/testsuite/ld-elfvers/vers16.dsym