]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
readelf: Display the base symbol version as empty string
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 6 Nov 2025 00:20:26 +0000 (08:20 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Nov 2025 22:39:42 +0000 (06:39 +0800)
commit2be0f2da2100cc2b5047f5d055cd039ac494d563
tree3c92e00175c844ac4dffc1d34c382bb83ef5eb1c
parent767c92a13e92d3c34b8ed6f3b6f1bf17eca57cbd
readelf: Display the base symbol version as empty string

Update readelf to display the base symbol version as

Symbol table for image contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000003008     0 OBJECT  GLOBAL DEFAULT   10 bar@@
     2: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS VERS_1
     3: 0000000000003008     0 OBJECT  GLOBAL DEFAULT   10 bar@@VERS_1
     4: 0000000000003000     0 OBJECT  GLOBAL DEFAULT   10 foo@

instead of

Symbol table for image contains 5 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000003008     0 OBJECT  GLOBAL DEFAULT   10 bar
     2: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  ABS VERS_1
     3: 0000000000003008     0 OBJECT  GLOBAL DEFAULT   10 bar@@VERS_1
     4: 0000000000003000     0 OBJECT  GLOBAL DEFAULT   10 foo

That is bar@@ and foo@ vs bar and foo.

binutils/

PR binutils/33599
* readelf.c (process_version_sections): Replace 0x8001 with
(VERSYM_HIDDEN | VERSYM_BASE).
(get_symbol_version_string): Likewise.  Return "" for the base
version.

include/

PR binutils/33599
* elf/common.h (VERSYM_BASE): New.

ld/

PR binutils/33599
* testsuite/ld-elf/pr33599.d: New file.
* testsuite/ld-elf/pr33599.map: Likewise.
* testsuite/ld-elf/pr33599.s: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
binutils/readelf.c
include/elf/common.h
ld/testsuite/ld-elf/pr33599.d [new file with mode: 0644]
ld/testsuite/ld-elf/pr33599.map [new file with mode: 0644]
ld/testsuite/ld-elf/pr33599.s [new file with mode: 0644]