From 9d989d6b0564fce4eb7b18306c85fcc38a24d346 Mon Sep 17 00:00:00 2001 From: Alexander Potapenko Date: Wed, 25 Dec 2013 17:20:22 +0000 Subject: [PATCH] [ASan] Add a test for __asan_gen_ globals labels on Darwin. Per Nick Kledzik (http://llvm.org/bugs/show_bug.cgi?id=17976): """ For MacOSX, the labels in __cstring section should be 'L' labels, and the labels in the __const section should be non-L or 'l' labels. The later ('l') will cause the linker to remove the label in the final executable. """ , so we need to ensure that the globals emitted by ASan have appropriate labels. llvm-svn: 198022 --- .../TestCases/Darwin/asan_gen_prefixes.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 compiler-rt/lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc diff --git a/compiler-rt/lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc b/compiler-rt/lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc new file mode 100644 index 000000000000..13363ac47255 --- /dev/null +++ b/compiler-rt/lib/asan/lit_tests/TestCases/Darwin/asan_gen_prefixes.cc @@ -0,0 +1,14 @@ +// Make sure __asan_gen_* strings have the correct prefixes on Darwin +// ("L" in __TEXT,__cstring, "l" in __TEXT,__const + +// RUN: %clang_asan %s -S -o %t.s +// RUN: cat %t.s | FileCheck %s || exit 1 + +int x, y, z; +int main() { return 0; } +// CHECK: .section{{.*}}__TEXT,__const +// CHECK: l___asan_gen_ +// CHECK: .section{{.*}}__TEXT,__cstring,cstring_literals +// CHECK: L___asan_gen_ +// CHECK: L___asan_gen_ +// CHECK: L___asan_gen_