diff options
| author | Anna Zaks <ganna@apple.com> | 2015-06-09 00:58:08 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2015-06-09 00:58:08 +0000 |
| commit | 119046098a1b0a862b292c2937c5b625880a19ef (patch) | |
| tree | 1e681dffd7e9e1a258c03fb168c12ef5d86247b7 /llvm/test | |
| parent | 705eb8f6b1bf02ec79ba045631114bd68ea26bf7 (diff) | |
| download | bcm5719-llvm-119046098a1b0a862b292c2937c5b625880a19ef.tar.gz bcm5719-llvm-119046098a1b0a862b292c2937c5b625880a19ef.zip | |
[asan] Prevent __attribute__((annotate)) triggering errors on Darwin
The following code triggers a fatal error in the compiler instrumentation
of ASan on Darwin because we place the attribute into llvm.metadata section,
which does not have the proper MachO section name.
void foo() __attribute__((annotate("custom")));
void foo() {;}
This commit reorders the checks so that we skip everything in llvm.metadata
first. It also removes the hard failure in case the section name does not
parse. That check will be done lower in the compilation pipeline anyway.
(Reviewed in http://reviews.llvm.org/D9093.)
llvm-svn: 239379
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll new file mode 100644 index 00000000000..7617dbde0b7 --- /dev/null +++ b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-llvm-metadata-darwin.ll @@ -0,0 +1,12 @@ +; This test checks that we are not instrumenting globals in llvm.metadata. +; RUN: opt < %s -asan -asan-module -S | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.10.0" + +@.str_noinst = private unnamed_addr constant [4 x i8] c"aaa\00", section "llvm.metadata" +@.str_inst = private unnamed_addr constant [4 x i8] c"aaa\00" + +; CHECK-NOT: {{asan_gen.*str_noinst}} +; CHECK: {{asan_gen.*str_inst}} +; CHECK: @asan.module_ctor |

