Index: tests_lit/asan_tests/globalredzones.ll |
diff --git a/tests_lit/asan_tests/globalredzones.ll b/tests_lit/asan_tests/globalredzones.ll |
new file mode 100644 |
index 0000000000000000000000000000000000000000..949ab5a74e36dd448b6c9407a2bbacba6ffa81b5 |
--- /dev/null |
+++ b/tests_lit/asan_tests/globalredzones.ll |
@@ -0,0 +1,81 @@ |
+; Test of global redzone layout |
+ |
+; REQUIRES: allow_dump |
+ |
+; RUN: %lc2i -i %s --args -threads=0 -fsanitize-address \ |
Karl
2016/06/13 17:55:50
nit: %p2i (rather than %lc2i)is a better choice. l
tlively
2016/06/13 18:17:26
Done.
|
+; RUN: | %iflc FileCheck %s |
+; RUN: %lc2i -i %s --args -verbose=global_init,inst -threads=0 \ |
Karl
2016/06/13 17:55:49
Same here.
tlively
2016/06/13 18:17:26
Done.
|
+; RUN: -fsanitize-address | %iflc FileCheck --check-prefix=DUMP %s |
+ |
+; DUMP-LABEL: ========= Instrumented Globals ========= |
+ |
+; The array of redzones |
+; CHECK-LABEL: .type __$rz0,%object |
+; CHECK-NEXT: .section .rodata |
+; CHECK-NEXT: __$rz0: |
+; CHECK-NEXT: .long __$rz2 |
+; CHECK-NEXT: .long __$rz3 |
+; CHECK-NEXT: .long __$rz4 |
+; CHECK-NEXT: .long __$rz5 |
+; CHECK-NEXT: .long __$rz6 |
+; CHECK-NEXT: .long __$rz7 |
+; CHECK-LABEL: .type __$rz1,%object |
+; CHECK-NEXT: .section .rodata |
+; CHECK-NEXT: __$rz1: |
+; CHECK-NEXT: .byte 6 |
+; CHECK-NEXT: .byte 0 |
+; CHECK-NEXT: .byte 0 |
+; CHECK-NEXT: .byte 0 |
+; DUMP: @__$rz0 = internal constant <{ i32, i32, i32, i32, i32, i32 }> <{ i32 ptrtoint ([32 x i8]* @__$rz2 to i32), i32 ptrtoint ([32 x i8]* @__$rz3 to i32), i32 ptrtoint ([32 x i8]* @__$rz4 to i32), i32 ptrtoint ([32 x i8]* @__$rz5 to i32), i32 ptrtoint ([32 x i8]* @__$rz6 to i32), i32 ptrtoint ([32 x i8]* @__$rz7 to i32) }> |
+; DUMP-NEXT: @__$rz1 = internal constant [4 x i8] c"\06\00\00\00" |
+; A zero-initialized global |
+@zeroInitGlobal = internal global [32 x i8] zeroinitializer |
+; CHECK-LABEL: .type __$rz2,%object |
+; CHECK-NEXT: .section .bss |
+; CHECK-NEXT: __$rz2: |
+; CHECK-LABEL: .type zeroInitGlobal,%object |
+; CHECK-NEXT: .section .bss |
+; CHECK-NEXT: zeroInitGlobal: |
+; CHECK-LABEL: .type __$rz3,%object |
+; CHECK-NEXT: .section .bss |
+; CHECK-NEXT: __$rz3: |
+; DUMP-NEXT: @__$rz2 = internal global [32 x i8] zeroinitializer |
Karl
2016/06/13 17:55:50
Nit: I think that DUMP-NEXT's should appear first.
tlively
2016/06/13 18:17:26
Done.
|
+; DUMP-NEXT: @zeroInitGlobal = internal global [32 x i8] zeroinitializer |
+; DUMP-NEXT: @__$rz3 = internal global [32 x i8] zeroinitializer |
+ |
+; A constant-initialized global |
+@constInitGlobal = internal constant [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" |
Karl
2016/06/13 18:22:04
Note: Considering moving this to the next line (in
|
+; CHECK-LABEL: .type __$rz4,%object |
+; CHECK-NEXT: .section .rodata |
+; CHECK-NEXT: __$rz4: |
+; CHECK-LABEL: .type constInitGlobal,%object |
+; CHECK-NEXT: .section .rodata |
+; CHECK-NEXT: constInitGlobal: |
+; CHECK-LABEL: .type __$rz5,%object |
+; CHECK-NEXT: .section .rodata |
+; CHECK-NEXT: __$rz5: |
+; DUMP-NEXT: @__$rz4 = internal constant [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" |
+; DUMP-NEXT: @constInitGlobal = internal constant [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" |
+; DUMP-NEXT: @__$rz5 = internal constant [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" |
+ |
+; A regular global |
+@regInitGlobal = internal global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" |
+; CHECK-LABEL: .type __$rz6,%object |
+; CHECK-NEXT: .section .data |
+; CHECK-NEXT: __$rz6: |
+; CHECK-LABEL: .type regInitGlobal,%object |
+; CHECK-NEXT: .section .data |
+; CHECK-NEXT: regInitGlobal: |
+; CHECK-LABEL: .type __$rz7,%object |
+; CHECK-NEXT: .section .data |
+; CHECK-NEXT: __$rz7: |
+; DUMP-NEXT: @__$rz6 = internal global [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" |
+; DUMP-NEXT: @regInitGlobal = internal global [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345" |
+; DUMP-NEXT: @__$rz7 = internal global [32 x i8] c"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR" |
+ |
+define internal void @func() { |
+ ret void |
+} |
+ |
+; CHECK-LABEL: func: |
+; DUMP: define internal void @func() { |