export-symbols.s
1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# REQUIRES: x86
## Verify that the arguments --export-dynamic and --dynamic-list
## put the correct symbols in the dynamic symbol table.
# RUN: echo "{ *; };" > %t.list
# RUN: echo ".globl shared" > %t.s ; echo "shared = 0xDEADBEEF" >> %t.s
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t.s -o %t-shared.o
# RUN: ld.lld --shared %t-shared.o -o %t.so
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
## Use --fatal-warnings to confirm no diagnostics are emitted.
# RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %t.out
# RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %texport.out --export-dynamic
# RUN: ld.lld --fatal-warnings --defsym=defsym=_start %t.so %t.o -o %tlist.out --dynamic-list %t.list
# RUN: llvm-readelf --dyn-syms %t.out | FileCheck %s --check-prefix=NO-EXPORT
# RUN: llvm-readelf --dyn-syms %texport.out | FileCheck %s --check-prefix=EXPORT
# RUN: llvm-readelf --dyn-syms %tlist.out | FileCheck %s --check-prefix=EXPORT
# NO-EXPORT: Symbol table '.dynsym' contains 3 entries:
# NO-EXPORT: GLOBAL DEFAULT {{.*}} shared
# NO-EXPORT-NEXT: WEAK DEFAULT {{.*}} undef_weak
# EXPORT: Symbol table '.dynsym' contains 8 entries:
# EXPORT: GLOBAL DEFAULT {{.*}} shared
# EXPORT-NEXT: WEAK DEFAULT {{.*}} undef_weak
# EXPORT-NEXT: GLOBAL PROTECTED {{.*}} _start
# EXPORT-NEXT: GLOBAL DEFAULT ABS abs
# EXPORT-NEXT: GLOBAL DEFAULT {{.*}} common
# EXPORT-NEXT: WEAK DEFAULT {{.*}} weak_default
# EXPORT-NEXT: GLOBAL DEFAULT {{.*}} defsym
.weak undef_weak
.weak weak_default
weak_default:
.weak weak_internal
.internal weak_internal
weak_internal:
.weak weak_hidden
.internal weak_hidden
weak_hidden:
.weak weak_protected
.internal weak_protected
weak_protected:
.globl shared
.local local
local:
.comm common, 10
.globl abs
abs = 0xDEADBEEF
.globl hidden
.hidden hidden
hidden:
.globl _start
.protected _start
_start: