[0/3] Revert to using version index 1
Jan Beulich
jbeulich@suse.com
Fri Nov 21 08:15:57 GMT 2025
On 20.11.2025 16:29, Michael Matz wrote:
> Hello,
>
> [here's three patches that try to fix some of the recent version index
> breakage. I'd like to get approval for 1+2, but see below for why there
> are three.]
>
> Defined unversioned symbols certainly can use VER_NDX_GLOBAL (1) as their
> version index. There are different opinions if VER_NDX_LOCAL (0) should
> be usable for those as well, but many tools don't expect that, as in: link
> editors don't resolve against those (ld.bfd being an exception).
>
> So, no matter the opinions, the change from NDX_GLOBAL to NDX_LOCAL for
> defined symbols causes real-world breakage. It also has no precedent, as
> the reason for this change was a bug report about inconsistency for
> _undefined_ symbols vis Solaris.
>
> IMO it's reasonable to continue using the value 0 for undefined symbols
> (when the reference itself wasn't versioned); it increases consistency
> with other OSes and doesn't hurt existing infrastructure. (I do think
> value 1 is reasonable as well, FWIW)
>
> So, to that end the first patch makes it so that NDX_GLOBAL is again
> generated for defined, global unversioned symbols. It leaves alone the
> NDX_LOCAL for undefined syms.
>
> In connection to all the above readelf was also changed to print 'foo@@'
> for normal unversioned defined exported symbols (those using NDX_GLOBAL).
> I think that's harmful, as the symbol to resolve against (and hence what
> users will try to look up when investigating stuff) is named 'foo', not
> anything else. It's also very peculiar and not what other readelfs do.
>
> To that end the second patch reverts that part of 2be0f2da, but again only
> for NDX_GLOBAL. I.e. for symbols with a hidden unnamed version we
> continue printing 'foo@', which seems useful as an indication of something
> special going on (in particular a reference to 'foo' can not be resolve by
> such symbol).
>
> I really really want to have that second patch in as well. But just in
> case the decision is that readelf should indeed continue to print 'foo@@'
> for normal symbols then patch three is there to fix testsuite fallout from
> the first patch.
>
> I've tested the combination 1+2 and 1+2+3 on x86_64-linux on 155 targets
> without regressions. Okay for 1+2, please? :)
Okay, perhaps - as you indicated in a reply on the 3/3 sub-thread, in the
order 2, then 1.
Jan
More information about the Binutils
mailing list