Files
binutils-gdb/elfcpp
H.J. Lu e891646a32 gold: Treat symbols with version index 0 as unversioned
Oracle Solaris 11.4 Linker and Libraries Guide:

https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/version-symbol-section.html

defines VER_NDX_LOCAL to 0 with a comment, "Symbol has local scope".  This
leads to different interpretations by different linker implementations.
However Solaris as well as ld and ld.so in glibc always treat symbols
with version index 0 as unversioned symbols with global binding.  As
discussed in

https://sourceware.org/bugzilla/show_bug.cgi?id=33577

in hindsight, VER_NDX_NONE might be a better name.  Ali from Oracle is
working on clarifying what version index 0 really means for unversioned
symbols with global binding.  In the meantime, update gold to treat
symbols with version index 0 as unversioned with global binding.

elfcpp/

	PR gold/33577
	* elfcpp.h (VER_NDX_LOCAL): Update comments.
	(VER_NDX_GLOBAL): Likewise.

gold/

	PR gold/33577
	* dynobj.cc (Versions::symbol_section_contents): Set unversioned
	symbol version index to VER_NDX_LOCAL.
	* symtab.cc (Symbol_table::add_from_dynobj): Don't check
	VER_NDX_LOCAL.
	* testsuite/Makefile.am (check_SCRIPTS): Add ver_test_pr33577.sh.
	(check_DATA): Add ver_test_pr33577a.syms and
	ver_test_pr33577b.syms.
	(ver_test_pr33577a.syms): New rule.
	(ver_test_pr33577.so): Likewise.
	(ver_test_pr33577b.syms): Likewise.
	(ver_test_pr33577): Likewise.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/ver_matching_test.sh: Updated to checking missing
	Base version.
	* testsuite/ver_test_14.sh (check_missing): New.
	Updated to check missing Base version.
	* testsuite/ver_test_pr33577.sh: New fille.
	* testsuite/ver_test_pr33577a.c: Likewise.
	* testsuite/ver_test_pr33577b.c: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-18 06:13:16 +08:00
..
2025-07-13 08:35:45 +01:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

elfcpp is a C++ library for reading and writing ELF information.  This
was written to support gold, the ELF linker, and may not be generally
useful.

elfcpp does not do file I/O.  It deals only with offsets and memory
data.

For efficiency, most accessors are templates with two arguments: the
ELF file class (32 or 64 bits) and the endianness.


Copyright (C) 2012-2025 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.