| 1 |
/* Test if ObjC constant strings get placed in the correct section. */ |
| 2 |
/* Contributed by Ziemowit Laski <[email protected]> */ |
| 3 |
|
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-skip-if "" { *-*-* } { "-fgnu-runtime" } { "" } } */ |
| 6 |
/* { dg-options "-mno-constant-cfstrings" { target *-*-darwin* } } */ |
| 7 |
|
| 8 |
#include "../../../objc-obj-c++-shared/F-NSObject.h" |
| 9 |
#include "../../../objc-obj-c++-shared/runtime.h" /* For NEXT_OBJC_USE_NEW_INTERFACE. */ |
| 10 |
|
| 11 |
@interface NSConstantString: NSObject { |
| 12 |
char *cString; |
| 13 |
unsigned int len; |
| 14 |
} |
| 15 |
@end |
| 16 |
|
| 17 |
#ifdef NEXT_OBJC_USE_NEW_INTERFACE |
| 18 |
Class _NSConstantStringClassReference; |
| 19 |
#else |
| 20 |
extern struct objc_class _NSConstantStringClassReference; |
| 21 |
#endif |
| 22 |
|
| 23 |
const NSConstantString *appKey = @"MyApp"; |
| 24 |
|
| 25 |
/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ |
| 26 |
/* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ |
| 27 |
/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ |
| 28 |
/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ |