• 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 -S | FileCheck %s
4
5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-linux-gnu"
7
8; Function Attrs: nounwind uwtable
9define internal void @_ZL3foov() #0 {
10entry:
11  ret void
12}
13
14@__call_foo = global void ()* @_ZL3foov, section ".preinit_array", align 8
15@__call_foo_2 = global void ()* @_ZL3foov, section ".init_array", align 8
16@__call_foo_3 = global void ()* @_ZL3foov, section ".fini_array", align 8
17
18; CHECK-NOT: asan_gen{{.*}}__call_foo
19
20; Function Attrs: nounwind uwtable
21define i32 @main() #0 {
22entry:
23  %retval = alloca i32, align 4
24  store i32 0, i32* %retval, align 4
25  ret i32 0
26}
27
28@.str_noinst = private unnamed_addr constant [4 x i8] c"aaa\00", section "llvm.metadata"
29@.str_noinst_prof = private unnamed_addr constant [4 x i8] c"aaa\00", section "__llvm_prf_data"
30@.str_inst = private unnamed_addr constant [4 x i8] c"aaa\00"
31
32; CHECK-NOT: {{asan_gen.*str_noinst}}
33; CHECK-NOT: {{asan_gen.*str_noinst_prof}}
34; CHECK: {{asan_gen.*str_inst}}
35; CHECK: @asan.module_ctor
36