[PATCH] readelf: Display the base symbol version as empty string
Fangrui Song
maskray@sourceware.org
Wed Nov 12 06:47:31 GMT 2025
On Wed, Nov 5, 2025 at 5:20 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 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.
>
> OK for master?
>
> --
> H.J.
Hmm, I am not sure this readelf change is desired.
.symver bar, bar@@
is invalid assembly syntax, so it seems wise to avoid `bar@@` in readelf output.
More information about the Binutils
mailing list