aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/const-str-9.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/const-str-9.m')
-rw-r--r--gcc/testsuite/objc.dg/const-str-9.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/const-str-9.m b/gcc/testsuite/objc.dg/const-str-9.m
new file mode 100644
index 00000000000..033337452d4
--- /dev/null
+++ b/gcc/testsuite/objc.dg/const-str-9.m
@@ -0,0 +1,20 @@
+/* Test if ObjC constant strings get placed in the correct section. */
+/* Contributed by Ziemowit Laski <zlaski@apple.com> */
+
+/* { dg-options "-fnext-runtime" } */
+/* { dg-do compile { target *-*-darwin* } } */
+
+#include <objc/Object.h>
+
+@interface NSConstantString: Object {
+ char *cString;
+ unsigned int len;
+}
+@end
+
+extern struct objc_class _NSConstantStringClassReference;
+
+static const NSConstantString *appKey = @"MyApp";
+
+/* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */
+/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" } } */