1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --global-value-regex ".*global_ctors.*" --version 5
2 ; RUN: opt < %s -passes=asan -S | FileCheck %s
3 ; RUN: opt < %s -passes=asan -S -asan-initialization-order=0 | FileCheck %s --check-prefixes=NOINIT
5 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"
6 target triple = "x86_64-unknown-linux-gnu"
8 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__late_ctor, ptr null }]
10 declare void @initializer() uwtable;
13 ; CHECK: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__late_ctor, ptr null }, { i32, ptr, ptr } { i32 1, ptr @asan.module_ctor, ptr @asan.module_ctor }]
15 ; NOINIT: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @__late_ctor, ptr null }, { i32, ptr, ptr } { i32 1, ptr @asan.module_ctor, ptr @asan.module_ctor }]
17 define internal void @__late_ctor() sanitize_address section ".text.startup" {
18 ; CHECK-LABEL: define internal void @__late_ctor(
19 ; CHECK-SAME: ) #[[ATTR1:[0-9]+]] section ".text.startup" {
20 ; CHECK-NEXT: [[ENTRY:.*:]]
21 ; CHECK-NEXT: call void @__asan_before_dynamic_init(i64 ptrtoint (ptr @___asan_gen_module to i64))
22 ; CHECK-NEXT: call void @initializer()
23 ; CHECK-NEXT: call void @__asan_after_dynamic_init()
24 ; CHECK-NEXT: ret void
26 ; NOINIT-LABEL: define internal void @__late_ctor(
27 ; NOINIT-SAME: ) #[[ATTR1:[0-9]+]] section ".text.startup" {
28 ; NOINIT-NEXT: [[ENTRY:.*:]]
29 ; NOINIT-NEXT: call void @initializer()
30 ; NOINIT-NEXT: ret void
34 call void @initializer()