summaryrefslogtreecommitdiff
path: root/lld/test/ELF/linkerscript/version-script.s
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-11-22 12:54:50 -0800
committerGitHub <noreply@github.com>2025-11-22 20:54:50 +0000
commitd96a93ff00ac02bc523d36dd2e687d597a068ae1 (patch)
tree6f8061f964b40218b645f2c70479c357693557c0 /lld/test/ELF/linkerscript/version-script.s
parent080ca902c6aaf1a1bf48df04a65ed163825b2006 (diff)
ELF: Use index 0 for unversioned undefined symbols (#168189)
The GNU documentation is ambiguous about the version index for unversioned undefined symbols. The current specification at https://sourceware.org/gnu-gabi/program-loading-and-dynamic-linking.txt defines VER_NDX_LOCAL (0) as "The symbol is private, and is not available outside this object." However, this naming is misleading for undefined symbols. As suggested in discussions, VER_NDX_LOCAL should conceptually be VER_NDX_NONE and apply to unversioned undefined symbols as well. GNU ld has used index 0 for unversioned undefined symbols both before version 2.35 (see https://sourceware.org/PR26002) and in the upcoming 2.46 release (see https://sourceware.org/PR33577). This change aligns with GNU ld's behavior by switching from index 1 to index 0. While here, add a test to dso-undef-extract-lazy.s that undefined symbols of index 0 in DSO are treated as unversioned symbols.
Diffstat (limited to 'lld/test/ELF/linkerscript/version-script.s')
-rw-r--r--lld/test/ELF/linkerscript/version-script.s2
1 files changed, 1 insertions, 1 deletions
diff --git a/lld/test/ELF/linkerscript/version-script.s b/lld/test/ELF/linkerscript/version-script.s
index 52382eeb1245..6b97fede00c3 100644
--- a/lld/test/ELF/linkerscript/version-script.s
+++ b/lld/test/ELF/linkerscript/version-script.s
@@ -17,7 +17,7 @@
# CHECK-NEXT: Name:
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Version: 1
+# CHECK-NEXT: Version: 0
# CHECK-NEXT: Name: und
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {