1; Test of global redzone layout 2 3; REQUIRES: allow_dump 4 5; RUN: %p2i -i %s --args -threads=0 -fsanitize-address \ 6; RUN: | FileCheck %s 7; RUN: %p2i -i %s --args -verbose=global_init,inst -threads=0 \ 8; RUN: -fsanitize-address | FileCheck --check-prefix=DUMP %s 9 10; The array of redzones 11 12; DUMP-LABEL: ========= Instrumented Globals ========= 13; DUMP: @__$rz_array = internal constant <{ i32, i32, i32, i32, i32, i32 }> 14; DUMP: <{ i32 ptrtoint ([32 x i8]* @__$rz0 to i32), i32 ptrtoint ([32 x i8]* @__$rz1 to i32), 15; DUMP: i32 ptrtoint ([32 x i8]* @__$rz2 to i32), i32 ptrtoint ([32 x i8]* @__$rz3 to i32), 16; DUMP: i32 ptrtoint ([32 x i8]* @__$rz4 to i32), i32 ptrtoint ([32 x i8]* @__$rz5 to i32) }> 17 18; (SPACE is 32 ascii) 19; DUMP-NEXT: @__$rz_sizes = internal constant <{ [4 x i8], [4 x i8], [4 x i8], [4 x i8], [4 x i8], 20; DUMP-SAME: [4 x i8] }> <{ [4 x i8] c" \00\00\00", [4 x i8] c" \00\00\00", [4 x i8] c" \00\00\00", 21; DUMP-SAME: [4 x i8] c" \00\00\00", [4 x i8] c" \00\00\00", [4 x i8] c" \00\00\00" }> 22 23; CHECK-LABEL: .type __$rz_array,%object 24; CHECK-NEXT: .section .rodata 25; CHECK-NEXT: __$rz_array: 26; CHECK-NEXT: .long __$rz0 27; CHECK-NEXT: .long __$rz1 28; CHECK-NEXT: .long __$rz2 29; CHECK-NEXT: .long __$rz3 30; CHECK-NEXT: .long __$rz4 31; CHECK-NEXT: .long __$rz5 32; CHECK-LABEL: .type __$rz_sizes,%object 33; CHECK-NEXT: .section .rodata 34; CHECK-NEXT: __$rz_sizes: 35; CHECK-NEXT: .byte 32 36; CHECK-NEXT: .byte 0 37; CHECK-NEXT: .byte 0 38; CHECK-NEXT: .byte 0 39; CHECK-NEXT: .byte 32 40; CHECK-NEXT: .byte 0 41; CHECK-NEXT: .byte 0 42; CHECK-NEXT: .byte 0 43; CHECK-NEXT: .byte 32 44; CHECK-NEXT: .byte 0 45; CHECK-NEXT: .byte 0 46; CHECK-NEXT: .byte 0 47; CHECK-NEXT: .byte 32 48; CHECK-NEXT: .byte 0 49; CHECK-NEXT: .byte 0 50; CHECK-NEXT: .byte 0 51; CHECK-NEXT: .byte 32 52; CHECK-NEXT: .byte 0 53; CHECK-NEXT: .byte 0 54; CHECK-NEXT: .byte 0 55; CHECK-NEXT: .byte 32 56; CHECK-NEXT: .byte 0 57; CHECK-NEXT: .byte 0 58; CHECK-NEXT: .byte 0 59 60; A zero-initialized global 61@zeroInitGlobal = internal global [32 x i8] zeroinitializer 62 63; DUMP-NEXT: @__$rz0 = internal global [32 x i8] zeroinitializer 64; DUMP-NEXT: @zeroInitGlobal = internal global [32 x i8] zeroinitializer 65; DUMP-NEXT: @__$rz1 = internal global [32 x i8] zeroinitializer 66 67; CHECK-LABEL: .type __$rz0,%object 68; CHECK-NEXT: .section .bss 69; CHECK-NEXT: .p2align 5 70; CHECK-NEXT: __$rz0: 71; CHECK-LABEL: .type zeroInitGlobal,%object 72; CHECK-NEXT: .section .bss 73; CHECK-NEXT: .p2align 5 74; CHECK-NEXT: zeroInitGlobal: 75; CHECK-LABEL: .type __$rz1,%object 76; CHECK-NEXT: .section .bss 77; CHECK-NEXT: __$rz1: 78 79; A constant-initialized global 80@constInitGlobal = internal constant [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" 81 82; CHECK-LABEL: .type __$rz2,%object 83; CHECK-NEXT: .section .rodata 84; CHECK-NEXT: .p2align 5 85; CHECK-NEXT: __$rz2: 86; CHECK-LABEL: .type constInitGlobal,%object 87; CHECK-NEXT: .section .rodata 88; CHECK-NEXT: .p2align 5 89; CHECK-NEXT: constInitGlobal: 90; CHECK-LABEL: .type __$rz3,%object 91; CHECK-NEXT: .section .rodata 92; CHECK-NEXT: __$rz3: 93 94; DUMP-NEXT: @__$rz2 = internal constant [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" 95; DUMP-NEXT: @constInitGlobal = internal constant [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" 96; DUMP-NEXT: @__$rz3 = internal constant [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" 97 98; A regular global 99@regInitGlobal = internal global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" 100 101; DUMP-NEXT: @__$rz4 = internal global [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" 102; DUMP-NEXT: @regInitGlobal = internal global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" 103; DUMP-NEXT: @__$rz5 = internal global [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" 104 105; CHECK-LABEL: .type __$rz4,%object 106; CHECK-NEXT: .section .data 107; CHECK-NEXT: .p2align 5 108; CHECK-NEXT: __$rz4: 109; CHECK-LABEL: .type regInitGlobal,%object 110; CHECK-NEXT: .section .data 111; CHECK-NEXT: .p2align 5 112; CHECK-NEXT: regInitGlobal: 113; CHECK-LABEL: .type __$rz5,%object 114; CHECK-NEXT: .section .data 115; CHECK-NEXT: __$rz5: 116 117define internal void @func() { 118 ret void 119} 120 121; DUMP-LABEL: define internal void @func() { 122; CHECK-LABEL: func: