1 ## Verify that -T removes Swift symbols.
2 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA \
3 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
4 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t1
5 # RUN: llvm-strip -x -T %t1
6 # RUN: llvm-readobj -s %t1 | FileCheck --check-prefix=NO-SWIFT-SYMBOLS %s
8 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA_CONST \
9 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
10 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t2
11 # RUN: llvm-strip -x -T %t2
12 # RUN: llvm-readobj -s %t2 | FileCheck --check-prefix=NO-SWIFT-SYMBOLS %s
14 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA_DIRTY \
15 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
16 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t3
17 # RUN: llvm-strip -x -T %t3
18 # RUN: llvm-readobj -s %t3 | FileCheck --check-prefix=NO-SWIFT-SYMBOLS %s
20 # NO-SWIFT-SYMBOLS: Symbols [
21 # NO-SWIFT-SYMBOLS-NEXT: Symbol {
22 # NO-SWIFT-SYMBOLS-NEXT: Name: _main (2)
23 # NO-SWIFT-SYMBOLS-NEXT: Extern
24 # NO-SWIFT-SYMBOLS-NEXT: Type: Section (0xE)
25 # NO-SWIFT-SYMBOLS-NEXT: Section: __text (0x1)
26 # NO-SWIFT-SYMBOLS-NEXT: RefType: UndefinedNonLazy (0x0)
27 # NO-SWIFT-SYMBOLS-NEXT: Flags [ (0x0)
28 # NO-SWIFT-SYMBOLS-NEXT: ]
29 # NO-SWIFT-SYMBOLS-NEXT: Value: 0x100000B70
30 # NO-SWIFT-SYMBOLS-NEXT: }
31 # NO-SWIFT-SYMBOLS-NEXT: ]
33 ## Verify that -T does not remove (public) Swift symbols when the binary
34 ## does not contain __objc_imageinfo in one of the expected segments.
36 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA \
37 # RUN: -D SECTION_NAME=__not_objc_imageinfo -D SECTION_SIZE=8 \
38 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t4
39 # RUN: llvm-strip -x -T %t4
40 # RUN: llvm-readobj -s %t4 | FileCheck --check-prefix=SWIFT-SYMBOLS %s
42 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__NOT_DATA \
43 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
44 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t5
45 # RUN: llvm-strip -x -T %t5
46 # RUN: llvm-readobj -s %t5 | FileCheck --check-prefix=SWIFT-SYMBOLS %s
48 ## Verify that -T does not remove (public) Swift symbols when swift_version is zero.
50 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA \
51 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
52 # RUN: -D SECTION_CONTENT=0000000000000000 %s -o %t6
53 # RUN: llvm-strip -x -T %t6
54 # RUN: llvm-readobj -s %t6 | FileCheck --check-prefix=SWIFT-SYMBOLS %s
56 ## Verify that -T does not remove (public) Swift symbols when the binary
57 ## contains invalid (too small) __objc_imageinfo.
59 # RUN: yaml2obj -D FLAGS=0x00200085 -D SEGMENT_NAME=__DATA \
60 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=4 \
61 # RUN: -D SECTION_CONTENT=00000000 %s -o %t7
62 # RUN: llvm-strip -x -T %t7
63 # RUN: llvm-readobj -s %t7 | FileCheck --check-prefix=SWIFT-SYMBOLS %s
65 ## Verify that -T does not remove (public) Swift symbols
66 ## when the flag MH_DYLDLINK is not set.
68 # RUN: yaml2obj -D FLAGS=0x00200000 -D SEGMENT_NAME=__DATA \
69 # RUN: -D SECTION_NAME=__objc_imageinfo -D SECTION_SIZE=8 \
70 # RUN: -D SECTION_CONTENT=0000000040070105 %s -o %t8
71 # RUN: llvm-strip -x -T %t8
72 # RUN: llvm-readobj -s %t8 | FileCheck --check-prefix=SWIFT-SYMBOLS %s
74 # SWIFT-SYMBOLS: Symbols [
75 # SWIFT-SYMBOLS-NEXT: Symbol {
76 # SWIFT-SYMBOLS-NEXT: Name: _$S1a13PublicSymbol1Sivp (27)
77 # SWIFT-SYMBOLS-NEXT: Extern
78 # SWIFT-SYMBOLS-NEXT: Type: Section (0xE)
79 # SWIFT-SYMBOLS-NEXT: Section: __text (0x1)
80 # SWIFT-SYMBOLS-NEXT: RefType: UndefinedNonLazy (0x0)
81 # SWIFT-SYMBOLS-NEXT: Flags [ (0x0)
82 # SWIFT-SYMBOLS-NEXT: ]
83 # SWIFT-SYMBOLS-NEXT: Value: 0x100001160
84 # SWIFT-SYMBOLS-NEXT: }
85 # SWIFT-SYMBOLS-NEXT: Symbol {
86 # SWIFT-SYMBOLS-NEXT: Name: _$s1a13PublicSymbol2Sivp (2)
87 # SWIFT-SYMBOLS-NEXT: Extern
88 # SWIFT-SYMBOLS-NEXT: Type: Section (0xE)
89 # SWIFT-SYMBOLS-NEXT: Section: __text (0x1)
90 # SWIFT-SYMBOLS-NEXT: RefType: UndefinedNonLazy (0x0)
91 # SWIFT-SYMBOLS-NEXT: Flags [ (0x0)
92 # SWIFT-SYMBOLS-NEXT: ]
93 # SWIFT-SYMBOLS-NEXT: Value: 0x100001168
94 # SWIFT-SYMBOLS-NEXT: }
95 # SWIFT-SYMBOLS-NEXT: Symbol {
96 # SWIFT-SYMBOLS-NEXT: Name: _main (52)
97 # SWIFT-SYMBOLS-NEXT: Extern
98 # SWIFT-SYMBOLS-NEXT: Type: Section (0xE)
99 # SWIFT-SYMBOLS-NEXT: Section: __text (0x1)
100 # SWIFT-SYMBOLS-NEXT: RefType: UndefinedNonLazy (0x0)
101 # SWIFT-SYMBOLS-NEXT: Flags [ (0x0)
102 # SWIFT-SYMBOLS-NEXT: ]
103 # SWIFT-SYMBOLS-NEXT: Value: 0x100000B70
104 # SWIFT-SYMBOLS-NEXT: }
105 # SWIFT-SYMBOLS-NEXT: ]
111 cpusubtype: 0x80000003
132 addr: 0x0000000100000B70
139 reserved1: 0x00000000
140 reserved2: 0x00000000
141 reserved3: 0x00000000
144 segname: [[SEGMENT_NAME]]
154 - sectname: [[SECTION_NAME]]
155 segname: [[SEGMENT_NAME]]
156 addr: 0x0000000100001090
157 size: [[SECTION_SIZE]]
163 reserved1: 0x00000000
164 reserved2: 0x00000000
165 reserved3: 0x00000000
166 content: "[[SECTION_CONTENT]]"
213 - '_$s1a12LocalSymbol2Sivp'
214 - '_$s1a13PublicSymbol2Sivp'
215 - '_$S1a12LocalSymbol1Sivp'
216 - '_$S1a13PublicSymbol1Sivp'