Skip to content

Commit 952685a

Browse files
committed
[ELF,test] Add static-pie test related to demoted lazy symbol
The reverted 1a4d6de ("[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 f10441a.
1 parent d4af658 commit 952685a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lld/test/ELF/weak-undef-lib.s

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
# CHECK-NEXT: Other: 0
1818
# CHECK-NEXT: Section: Undefined
1919

20+
# RUN: ld.lld -pie -o %t %t1.o --start-lib %t2.o --no-dynamic-linker
21+
# RUN: llvm-readelf --dyn-syms %t | FileCheck %s --check-prefix=STATICPIE
22+
23+
# STATICPIE: Symbol table '.dynsym' contains 1
24+
2025
## -u specifies a STB_DEFAULT undefined symbol, so the definition from %t2.o is
2126
## fetched.
2227
# RUN: ld.lld -u foo %t1.o --start-lib %t2.o -o %t1

0 commit comments

Comments
 (0)