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>
10 files changed