2 ## Verify that the arguments --export-dynamic and --dynamic-list
3 ## put the correct symbols in the dynamic symbol table.
5 # RUN: echo "{ *; };" > %t.list
7 # RUN: echo ".globl shared" > %t.s ; echo "shared = 0xDEADBEEF" >> %t.s
9 # RUN: llvm-mc -filetype=obj -triple=x86_64 %t.s -o %t-shared.o
10 # RUN: ld.lld --shared %t-shared.o -o %t.so
12 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
13 ## Use --fatal-warnings to confirm no diagnostics are emitted.
14 # RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %t.out
15 # RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %texport.out --export-dynamic
16 # RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %tlist.out --dynamic-list %t.list
18 # RUN: llvm-readelf --dyn-syms %t.out | FileCheck %s --check-prefix=NO-EXPORT
19 # RUN: llvm-readelf --dyn-syms %texport.out | FileCheck %s --check-prefix=EXPORT
20 # RUN: llvm-readelf --dyn-syms %tlist.out | FileCheck %s --check-prefix=EXPORT
22 # NO-EXPORT: Symbol table '.dynsym' contains 3 entries:
23 # NO-EXPORT: GLOBAL DEFAULT {{.*}} shared
24 # NO-EXPORT-NEXT: WEAK DEFAULT {{.*}} undef_weak
26 # EXPORT: Symbol table '.dynsym' contains 8 entries:
27 # EXPORT: GLOBAL DEFAULT {{.*}} shared
28 # EXPORT-NEXT: WEAK DEFAULT {{.*}} undef_weak
29 # EXPORT-NEXT: WEAK DEFAULT {{.*}} weak_default
30 # EXPORT-NEXT: GLOBAL DEFAULT {{.*}} common
31 # EXPORT-NEXT: GLOBAL DEFAULT ABS abs
32 # EXPORT-NEXT: GLOBAL PROTECTED {{.*}} _start
33 # EXPORT-NEXT: GLOBAL DEFAULT {{.*}} defsym
35 ## --no-export-dynamic can cancel previous --export-dynamic.
36 # RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o - --export-dynamic --no-export-dynamic | cmp %t.out -
44 .internal weak_internal
52 .internal weak_protected