summaryrefslogtreecommitdiffstats
path: root/llvm/test/Instrumentation
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-09-14 17:18:37 +0000
committerEtienne Bergeron <etienneb@google.com>2016-09-14 17:18:37 +0000
commit752f8839a4eb3d00a8f788c15a4732484e9a957d (patch)
tree0a9debdfcd21ce14d08105b9578f3f5b91ff944e /llvm/test/Instrumentation
parenta369219ce676ae960046ef00d6d23be2d10701ee (diff)
downloadbcm5719-llvm-752f8839a4eb3d00a8f788c15a4732484e9a957d.tar.gz
bcm5719-llvm-752f8839a4eb3d00a8f788c15a4732484e9a957d.zip
[compiler-rt] Avoid instrumenting sanitizer functions
Summary: Function __asan_default_options is called by __asan_init before the shadow memory got initialized. Instrumenting that function may lead to flaky execution. As the __asan_default_options is provided by users, we cannot expect them to add the appropriate function atttributes to avoid instrumentation. Reviewers: kcc, rnk Subscribers: dberris, chrisha, llvm-commits Differential Revision: https://reviews.llvm.org/D24566 llvm-svn: 281503
Diffstat (limited to 'llvm/test/Instrumentation')
-rw-r--r--llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-sanitizers.ll24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-sanitizers.ll b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-sanitizers.ll
new file mode 100644
index 00000000000..fc263aad784
--- /dev/null
+++ b/llvm/test/Instrumentation/AddressSanitizer/do-not-instrument-sanitizers.ll
@@ -0,0 +1,24 @@
+; This test checks that we are not instrumenting sanitizer code.
+; 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-unknown-linux-gnu"
+
+; Function Attrs: nounwind uwtable
+define void @__asan_default_options(i32* %a) sanitize_address {
+entry:
+ %tmp1 = load i32, i32* %a, align 4
+ %tmp2 = add i32 %tmp1, 1
+ store i32 %tmp2, i32* %a, align 4
+ ret void
+}
+
+; CHECK-NOT: call void @__asan_report_load
+
+; Function Attrs: nounwind uwtable
+define i32 @main() #0 {
+entry:
+ ret i32 0
+}
+
+; CHECK: declare void @__asan_init() \ No newline at end of file
OpenPOWER on IntegriCloud