|
3 | 3 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I %t %t/cat1.s -o %t/cat1.o
|
4 | 4 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I %t %t/cat2.s -o %t/cat2.o
|
5 | 5 | # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I %t %t/klass.s -o %t/klass.o
|
| 6 | +# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -I %t %t/klass-with-no-rodata.s -o %t/klass-with-no-rodata.o |
6 | 7 | # RUN: %lld -dylib -lobjc %t/klass.o -o %t/libklass.dylib
|
7 | 8 |
|
8 | 9 | # RUN: %no-fatal-warnings-lld -dylib -lobjc %t/klass.o %t/cat1.o %t/cat2.o -o \
|
9 | 10 | # RUN: /dev/null 2>&1 | FileCheck %s --check-prefixes=CATCLS,CATCAT
|
10 | 11 | # RUN: %no-fatal-warnings-lld -dylib -lobjc %t/libklass.dylib %t/cat1.o \
|
11 | 12 | # RUN: %t/cat2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=CATCAT
|
12 | 13 |
|
| 14 | +## Regression test: Check that we don't crash. |
| 15 | +# RUN: %no-fatal-warnings-lld -dylib -lobjc %t/klass-with-no-rodata.o -o /dev/null |
| 16 | + |
13 | 17 | # CATCLS: warning: method '+s1' has conflicting definitions:
|
14 | 18 | # CATCLS-NEXT: >>> defined in category Cat1 from {{.*}}cat1.o
|
15 | 19 | # CATCLS-NEXT: >>> defined in class Foo from {{.*}}klass.o
|
@@ -199,6 +203,42 @@ __OBJC_$_INSTANCE_METHODS_Foo:
|
199 | 203 |
|
200 | 204 | .subsections_via_symbols
|
201 | 205 |
|
| 206 | +#--- klass-with-no-rodata.s |
| 207 | + |
| 208 | +.include "objc-macros.s" |
| 209 | + |
| 210 | +## swiftc generates some classes without a statically-linked rodata. Not |
| 211 | +## entirely sure what the corresponding Swift inputs are required for this to |
| 212 | +## happen; this test merely checks that we can gracefully handle this case |
| 213 | +## without crashing. |
| 214 | +## FIXME: It would be better if this test used the output of some real Swift |
| 215 | +## code. |
| 216 | + |
| 217 | +.globl _$s11FooAACfD |
| 218 | + |
| 219 | +.section __DATA,__objc_data |
| 220 | +_$s11FooAACfD: |
| 221 | + .quad _$s11FooAACfD |
| 222 | + .quad 0 |
| 223 | + .quad __objc_empty_cache |
| 224 | + .quad 0 |
| 225 | + .quad __objc_empty_cache |
| 226 | + |
| 227 | +.section __DATA,__objc_catlist,regular,no_dead_strip |
| 228 | + .quad __CATEGORY_METAFoo_$_Foo20 |
| 229 | + |
| 230 | +.section __DATA,__objc_const |
| 231 | +__CATEGORY_METAFoo_$_Foo20: |
| 232 | + .objc_classname "Foo20" |
| 233 | + .quad _$s11FooAACfD |
| 234 | + .quad 0 |
| 235 | + .quad 0 |
| 236 | + .quad 0 |
| 237 | + .quad 0 |
| 238 | + .quad 0 |
| 239 | + .long 64 |
| 240 | + .space 4 |
| 241 | + |
202 | 242 | #--- objc-macros.s
|
203 | 243 |
|
204 | 244 | # Macros for taking some of the boilerplate out of defining objc structs.
|
|
0 commit comments