[lld] 952685a - [ELF, test] Add static-pie test related to demoted lazy symbol
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 22:19:53 PST 2025
Author: Fangrui Song
Date: 2025-01-27T22:19:48-08:00
New Revision: 952685a43d0436577df95ea318b2460438f67982
URL: https://github.com/llvm/llvm-project/commit/952685a43d0436577df95ea318b2460438f67982
DIFF: https://github.com/llvm/llvm-project/commit/952685a43d0436577df95ea318b2460438f67982.diff
LOG: [ELF,test] Add static-pie test related to demoted lazy symbol
The reverted
1a4d6de1b532149b10522eae5dabce39e5f7c687
("[ELF] Remove redundant isExported computation")
had incorrect
```
+ if (sym->includeInDynsym(ctx))
+ sym->isExported = true;
```
causing undefined weak symbols (defined in archives, demoted; e.g.
__cxa_finalize) to be exported for static-pie.
Add a regression test for this corner case. The issue actually exposed
another issue related to includeInDynsym, which has been fixed by
f10441ad003236ef3b9e5415a571d2be0c0ce5ce.
Added:
Modified:
lld/test/ELF/weak-undef-lib.s
Removed:
################################################################################
diff --git a/lld/test/ELF/weak-undef-lib.s b/lld/test/ELF/weak-undef-lib.s
index 19b59fddaa7231..a554e1d5a2f899 100644
--- a/lld/test/ELF/weak-undef-lib.s
+++ b/lld/test/ELF/weak-undef-lib.s
@@ -17,6 +17,11 @@
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
+# RUN: ld.lld -pie -o %t %t1.o --start-lib %t2.o --no-dynamic-linker
+# RUN: llvm-readelf --dyn-syms %t | FileCheck %s --check-prefix=STATICPIE
+
+# STATICPIE: Symbol table '.dynsym' contains 1
+
## -u specifies a STB_DEFAULT undefined symbol, so the definition from %t2.o is
## fetched.
# RUN: ld.lld -u foo %t1.o --start-lib %t2.o -o %t1
More information about the llvm-commits
mailing list