diff options
author | Kostya Serebryany <kcc@google.com> | 2012-11-20 13:11:32 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-11-20 13:11:32 +0000 |
commit | 407790604b8f71f7172bbdfb76c27e1799d241c2 (patch) | |
tree | 839d1d4709c32d80d15c0af21b5a721e58c029ae /test/Instrumentation/AddressSanitizer | |
parent | ca23d43084c45a7d6f4371d62f45be044650ce38 (diff) | |
download | external_llvm-407790604b8f71f7172bbdfb76c27e1799d241c2.zip external_llvm-407790604b8f71f7172bbdfb76c27e1799d241c2.tar.gz external_llvm-407790604b8f71f7172bbdfb76c27e1799d241c2.tar.bz2 |
[asan] don't instrument linker-initialized globals even with external linkage in -asan-initialization-order mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168367 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation/AddressSanitizer')
-rw-r--r-- | test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll index fe13cd1..c11a049 100644 --- a/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll +++ b/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll @@ -2,11 +2,14 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-unknown-linux-gnu" @xxx = internal global i32 0, align 4 ; With dynamic initializer. +@XXX = global i32 0, align 4 ; With dynamic initializer. @yyy = internal global i32 0, align 4 ; W/o dynamic initializer. +@YYY = global i32 0, align 4 ; W/o dynamic initializer. ; Clang will emit the following metadata identifying @xxx as dynamically ; initialized. !0 = metadata !{i32* @xxx} -!llvm.asan.dynamically_initialized_globals = !{!0} +!1 = metadata !{i32* @XXX} +!llvm.asan.dynamically_initialized_globals = !{!0, !1} define i32 @initializer() uwtable { entry: @@ -45,6 +48,16 @@ define void @touch_xxx() address_safety { ; CHECK: ret void } +; Check that XXX is instrumented. +define void @touch_XXX() address_safety { + store i32 0, i32 *@XXX, align 4 + ret void +; CHECK: define void @touch_XXX +; CHECK: call void @__asan_report_store4 +; CHECK: ret void +} + + ; Check that yyy is NOT instrumented (as it does not have dynamic initializer). define void @touch_yyy() address_safety { store i32 0, i32 *@yyy, align 4 @@ -53,3 +66,12 @@ define void @touch_yyy() address_safety { ; CHECK-NOT: call void @__asan_report_store4 ; CHECK: ret void } + +; Check that YYY is NOT instrumented (as it does not have dynamic initializer). +define void @touch_YYY() address_safety { + store i32 0, i32 *@YYY, align 4 + ret void +; CHECK: define void @touch_YYY +; CHECK-NOT: call void @__asan_report_store4 +; CHECK: ret void +} |