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