File: local-symbol-output.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (144 lines) | stat: -rw-r--r-- 4,852 bytes parent folder | download | duplicates (14)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# REQUIRES: x86

# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/main.s -o %t/main.o

## Check that -non_global_symbols_no_strip_list and -non_global_symbols_strip_list
## can't be used at the same time.
# RUN: not %lld %t/main.o -o /dev/null \
# RUN:       -non_global_symbols_no_strip_list %t/foo.txt \
# RUN:       -non_global_symbols_strip_list %t/foo.txt 2>&1 | \
# RUN:     FileCheck --check-prefix=CONFLICT %s

# CONFLICT: error: cannot use both -non_global_symbols_no_strip_list and -non_global_symbols_strip_list

## Check that -x causes none of the local symbols to be emitted.
# RUN: %lld %t/main.o -x -o %t/NO-LOCAL.out
# RUN: llvm-nm %t/NO-LOCAL.out | FileCheck --check-prefix NO-LOCAL %s

# NO-LOCAL-NOT: t _foo
# NO-LOCAL-NOT: t _bar
# NO-LOCAL-NOT: t _baz
# NO-LOCAL: T _main

## Check that when using -x with -non_global_symbols_no_strip_list, whichever appears
## last in the command line arg list will take precedence.
# RUN: %lld %t/main.o -x -non_global_symbols_no_strip_list %t/foo.txt -o %t/x_then_no_strip.out
# RUN: llvm-nm %t/x_then_no_strip.out | FileCheck --check-prefix X-NO-STRIP %s

# RUN: %lld %t/main.o -non_global_symbols_no_strip_list %t/foo.txt -x -o %t/no_strip_then_x.out
# RUN: llvm-nm %t/no_strip_then_x.out | FileCheck --check-prefix NO-LOCAL %s

# X-NO-STRIP-NOT: t _bar
# X-NO-STRIP-DAG: t _foo
# X-NO-STRIP-DAG: T _main

## Check that -non_global_symbols_no_strip_list can be specified more than once
## (The final no-strip list is the union of all these)
# RUN: %lld %t/main.o -o %t/no_strip_multi.out \
# RUN:    -non_global_symbols_no_strip_list %t/foo.txt \
# RUN:    -non_global_symbols_no_strip_list %t/bar.txt
# RUN: llvm-nm %t/no_strip_multi.out | FileCheck --check-prefix NO-STRIP-MULTI %s

# NO-STRIP-MULTI-NOT: t _baz
# NO-STRIP-MULTI-DAG: t _foo
# NO-STRIP-MULTI-DAG: t _bar
# NO-STRIP-MULTI-DAG: T _main

## Check that when using -x with -non_global_symbols_strip_list, whichever appears
## last in the command line arg list will take precedence.
# RUN: %lld %t/main.o -x -non_global_symbols_strip_list %t/foo.txt -o %t/x_then_strip.out
# RUN: llvm-nm %t/x_then_strip.out | FileCheck --check-prefix X-STRIP %s

# RUN: %lld %t/main.o -non_global_symbols_strip_list %t/foo.txt -x -o %t/strip_then_x.out
# RUN: llvm-nm %t/no_strip_then_x.out | FileCheck --check-prefix NO-LOCAL %s

# X-STRIP-NOT: t _foo
# X-STRIP-DAG: t _bar
# X-STRIP-DAG: t _baz
# X-STRIP-DAG: T _main

## Check that -non_global_symbols_strip_list can be specified more than once
## (The final strip list is the union of all these)
# RUN: %lld %t/main.o -o %t/strip_multi.out \
# RUN:    -non_global_symbols_strip_list %t/foo.txt \
# RUN:    -non_global_symbols_strip_list %t/bar.txt
# RUN: llvm-nm %t/strip_multi.out | FileCheck --check-prefix STRIP-MULTI %s

# STRIP-MULTI-NOT: t _foo
# STRIP-MULTI-NOT: t _bar
# STRIP-MULTI-DAG: t _baz
# STRIP-MULTI-DAG: T _main

## Test interactions with exported_symbol.
# RUN: %lld %t/main.o -o %t/strip_all_export_one.out \
# RUN:    -x -exported_symbol _foo \
# RUN:    -undefined dynamic_lookup
# RUN: llvm-nm %t/strip_all_export_one.out | FileCheck --check-prefix STRIP-EXP %s

# STRIP-EXP: U _foo
# STRIP-EXP: U dyld_stub_binder
# STRIP-EXP-EMPTY:

## Test interactions of -x and -non_global_symbols_strip_list with unexported_symbol.
# RUN: %lld %t/main.o -o %t/strip_x_unexport_one.out \
# RUN:    -x -unexported_symbol _globby \
# RUN:    -undefined dynamic_lookup

# RUN: %lld %t/main.o -o %t/strip_all_unexport_one.out \
# RUN:    -non_global_symbols_strip_list %t/globby.txt \
# RUN:    -non_global_symbols_strip_list %t/foo.txt \
# RUN:    -non_global_symbols_strip_list %t/bar.txt \
# RUN:    -unexported_symbol _globby \
# RUN:    -undefined dynamic_lookup

# RUN: llvm-nm %t/strip_x_unexport_one.out | FileCheck --check-prefix STRIP-UNEXP %s
# RUN: llvm-nm %t/strip_all_unexport_one.out | FileCheck --check-prefix STRIP-UNEXP %s

## -unexported_symbol made _globby a local, therefore it should be stripped by -x too
# STRIP-UNEXP: T __mh_execute_header
# STRIP-UNEXP-DAG: T _main
# STRIP-UNEXP-DAG: U dyld_stub_binder
# STRIP-UNEXP-EMPTY:

## Test interactions of -non_global_symbols_strip_list and unexported_symbol.
# RUN: %lld %t/main.o -undefined dynamic_lookup -o %t/no_strip_unexport.out \
# RUN:    -non_global_symbols_no_strip_list %t/globby.txt \
# RUN:    -unexported_symbol _globby

# RUN: llvm-nm %t/no_strip_unexport.out | FileCheck --check-prefix NOSTRIP-UNEXP %s

# NOSTRIP-UNEXP: T __mh_execute_header
# NOSTRIP-UNEXP-DAG: T _main
# NOSTRIP-UNEXP-DAG: t _globby
# NOSTRIP-UNEXP-DAG: U dyld_stub_binder
# NOSTRIP-UNEXP-EMPTY:

#--- foo.txt
_foo

#--- bar.txt
_bar

#--- globby.txt
_globby

#--- main.s
.globl _main
.globl _globby

_foo:
  ret

_bar:
  ret

_baz:
  ret

_main:
  callq _foo
  ret

 _globby:
  ret