aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Darwin/cstring_section.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/asan/TestCases/Darwin/cstring_section.c')
-rw-r--r--test/asan/TestCases/Darwin/cstring_section.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/asan/TestCases/Darwin/cstring_section.c b/test/asan/TestCases/Darwin/cstring_section.c
new file mode 100644
index 000000000000..952d6fcdd465
--- /dev/null
+++ b/test/asan/TestCases/Darwin/cstring_section.c
@@ -0,0 +1,17 @@
+// Test that AddressSanitizer moves constant strings into a separate section.
+
+// RUN: %clang_asan -c -o %t %s
+// RUN: llvm-objdump -s %t | FileCheck %s
+
+// Check that "Hello.\n" is in __asan_cstring and not in __cstring.
+// CHECK: Contents of section __asan_cstring:
+// CHECK: 48656c6c {{.*}} Hello.
+// CHECK: Contents of section __const:
+// CHECK-NOT: 48656c6c {{.*}} Hello.
+// CHECK: Contents of section __cstring:
+// CHECK-NOT: 48656c6c {{.*}} Hello.
+
+int main(int argc, char *argv[]) {
+ argv[0] = "Hello.\n";
+ return 0;
+}