|
11 | 11 |
|
12 | 12 | // RUN: %clang_cc1 -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fsanitize-minimal-runtime -fsanitize-handler-preserve-all-regs -flto -fvisibility=hidden -triple x86_64-unknown-linux -fwhole-program-vtables -emit-llvm -o - %s | FileCheck --check-prefix=PRESERVE_MIN %s |
13 | 13 |
|
| 14 | +// RUN: %clang_cc1 -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-minimal-runtime -fsanitize-handler-preserve-all-regs -flto -fvisibility=hidden -triple x86_64-unknown-linux -fwhole-program-vtables -emit-llvm -o - %s | FileCheck --check-prefix=PRESERVE_ABORT_MIN %s |
| 15 | + |
14 | 16 |
|
15 | 17 | // TRAP-LABEL: define hidden void @f( |
16 | 18 | // TRAP-SAME: ) #[[ATTR0:[0-9]+]] !type [[META6:![0-9]+]] !type [[META7:![0-9]+]] { |
|
42 | 44 | // PRESERVE_MIN-NEXT: [[ENTRY:.*:]] |
43 | 45 | // PRESERVE_MIN-NEXT: ret void |
44 | 46 | // |
| 47 | +// PRESERVE_ABORT_MIN-LABEL: define hidden void @f( |
| 48 | +// PRESERVE_ABORT_MIN-SAME: ) #[[ATTR0:[0-9]+]] !type [[META6:![0-9]+]] !type [[META7:![0-9]+]] { |
| 49 | +// PRESERVE_ABORT_MIN-NEXT: [[ENTRY:.*:]] |
| 50 | +// PRESERVE_ABORT_MIN-NEXT: ret void |
| 51 | +// |
45 | 52 | void f() { |
46 | 53 | } |
47 | 54 |
|
@@ -175,6 +182,27 @@ void xf(); |
175 | 182 | // PRESERVE_MIN-NEXT: call void (...) [[TMP2]]() |
176 | 183 | // PRESERVE_MIN-NEXT: ret void |
177 | 184 | // |
| 185 | +// PRESERVE_ABORT_MIN-LABEL: define hidden void @g( |
| 186 | +// PRESERVE_ABORT_MIN-SAME: i32 noundef [[B:%.*]]) #[[ATTR0]] !type [[META8:![0-9]+]] !type [[META9:![0-9]+]] { |
| 187 | +// PRESERVE_ABORT_MIN-NEXT: [[ENTRY:.*:]] |
| 188 | +// PRESERVE_ABORT_MIN-NEXT: [[B_ADDR:%.*]] = alloca i32, align 4 |
| 189 | +// PRESERVE_ABORT_MIN-NEXT: [[FP:%.*]] = alloca ptr, align 8 |
| 190 | +// PRESERVE_ABORT_MIN-NEXT: store i32 [[B]], ptr [[B_ADDR]], align 4 |
| 191 | +// PRESERVE_ABORT_MIN-NEXT: [[TMP0:%.*]] = load i32, ptr [[B_ADDR]], align 4 |
| 192 | +// PRESERVE_ABORT_MIN-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[TMP0]], 0 |
| 193 | +// PRESERVE_ABORT_MIN-NEXT: [[TMP1:%.*]] = zext i1 [[TOBOOL]] to i64 |
| 194 | +// PRESERVE_ABORT_MIN-NEXT: [[COND:%.*]] = select i1 [[TOBOOL]], ptr @f, ptr @xf |
| 195 | +// PRESERVE_ABORT_MIN-NEXT: store ptr [[COND]], ptr [[FP]], align 8 |
| 196 | +// PRESERVE_ABORT_MIN-NEXT: [[TMP2:%.*]] = load ptr, ptr [[FP]], align 8 |
| 197 | +// PRESERVE_ABORT_MIN-NEXT: [[TMP3:%.*]] = call i1 @llvm.type.test(ptr [[TMP2]], metadata !"_ZTSFvE"), !nosanitize [[META10:![0-9]+]] |
| 198 | +// PRESERVE_ABORT_MIN-NEXT: br i1 [[TMP3]], label %[[CONT:.*]], label %[[HANDLER_CFI_CHECK_FAIL:.*]], !prof [[PROF11:![0-9]+]], !nosanitize [[META10]] |
| 199 | +// PRESERVE_ABORT_MIN: [[HANDLER_CFI_CHECK_FAIL]]: |
| 200 | +// PRESERVE_ABORT_MIN-NEXT: call void @__ubsan_handle_cfi_check_fail_minimal_abort() #[[ATTR4:[0-9]+]], !nosanitize [[META10]] |
| 201 | +// PRESERVE_ABORT_MIN-NEXT: unreachable, !nosanitize [[META10]] |
| 202 | +// PRESERVE_ABORT_MIN: [[CONT]]: |
| 203 | +// PRESERVE_ABORT_MIN-NEXT: call void (...) [[TMP2]]() |
| 204 | +// PRESERVE_ABORT_MIN-NEXT: ret void |
| 205 | +// |
178 | 206 | void g(int b) { |
179 | 207 | void (*fp)() = b ? f : xf; |
180 | 208 | fp(); |
@@ -222,3 +250,10 @@ void g(int b) { |
222 | 250 | // PRESERVE_MIN: [[META10]] = !{} |
223 | 251 | // PRESERVE_MIN: [[PROF11]] = !{!"branch_weights", i32 1048575, i32 1} |
224 | 252 | //. |
| 253 | +// PRESERVE_ABORT_MIN: [[META6]] = !{i64 0, !"_ZTSFvE"} |
| 254 | +// PRESERVE_ABORT_MIN: [[META7]] = !{i64 0, !"_ZTSFvE.generalized"} |
| 255 | +// PRESERVE_ABORT_MIN: [[META8]] = !{i64 0, !"_ZTSFviE"} |
| 256 | +// PRESERVE_ABORT_MIN: [[META9]] = !{i64 0, !"_ZTSFviE.generalized"} |
| 257 | +// PRESERVE_ABORT_MIN: [[META10]] = !{} |
| 258 | +// PRESERVE_ABORT_MIN: [[PROF11]] = !{!"branch_weights", i32 1048575, i32 1} |
| 259 | +//. |
0 commit comments