1*9880d681SAndroid Build Coastguard Worker; This test checks that we are not instrumenting unnecessary globals
2*9880d681SAndroid Build Coastguard Worker; (llvm.metadata, init_array sections, and other llvm internal globals).
3*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -asan -asan-module -S | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable
9*9880d681SAndroid Build Coastguard Workerdefine internal void @_ZL3foov() #0 {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  ret void
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker@__call_foo = global void ()* @_ZL3foov, section ".preinit_array", align 8
15*9880d681SAndroid Build Coastguard Worker@__call_foo_2 = global void ()* @_ZL3foov, section ".init_array", align 8
16*9880d681SAndroid Build Coastguard Worker@__call_foo_3 = global void ()* @_ZL3foov, section ".fini_array", align 8
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: asan_gen{{.*}}__call_foo
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind uwtable
21*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 {
22*9880d681SAndroid Build Coastguard Workerentry:
23*9880d681SAndroid Build Coastguard Worker  %retval = alloca i32, align 4
24*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %retval, align 4
25*9880d681SAndroid Build Coastguard Worker  ret i32 0
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker@.str_noinst = private unnamed_addr constant [4 x i8] c"aaa\00", section "llvm.metadata"
29*9880d681SAndroid Build Coastguard Worker@.str_noinst_prof = private unnamed_addr constant [4 x i8] c"aaa\00", section "__llvm_prf_data"
30*9880d681SAndroid Build Coastguard Worker@.str_inst = private unnamed_addr constant [4 x i8] c"aaa\00"
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{asan_gen.*str_noinst}}
33*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{asan_gen.*str_noinst_prof}}
34*9880d681SAndroid Build Coastguard Worker; CHECK: {{asan_gen.*str_inst}}
35*9880d681SAndroid Build Coastguard Worker; CHECK: @asan.module_ctor
36