1// Test that AddressSanitizer moves constant strings into a separate section.
2
3// RUN: %clang_asan -c -o %t %s
4// RUN: llvm-objdump -s %t | FileCheck %s
5
6// Check that "Hello.\n" is in __asan_cstring and not in __cstring.
7// CHECK: Contents of section {{.*}}__asan_cstring:
8// CHECK: 48656c6c {{.*}} Hello.
9// CHECK: Contents of section {{.*}}__const:
10// CHECK-NOT: 48656c6c {{.*}} Hello.
11// CHECK: Contents of section {{.*}}__cstring:
12// CHECK-NOT: 48656c6c {{.*}} Hello.
13
14int main(int argc, char *argv[]) {
15 argv[0] = "Hello.\n";
16 return 0;
17}
18

source code of compiler-rt/test/asan/TestCases/Darwin/cstring_section.c