1 // REQUIRES: x86-registered-target
3 // RUN: %clang_cc1 -triple x86_64-unknown-fuchsia -O2 -flto -ffat-lto-objects \
4 // RUN: -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fvisibility=hidden -emit-llvm -o - %s \
7 // CHECK: llvm.embedded.object
8 // CHECK-SAME: section ".llvm.lto"
10 // CHECK-LABEL: define hidden void @foo
12 // CHECK-NEXT: %cmp14.not = icmp eq i64 %len, 0
13 // CHECK-NEXT: br i1 %cmp14.not, label %for.end7, label %for.cond1.preheader.preheader
14 // CHECK: for.cond1.preheader.preheader: ; preds = %entry
15 // CHECK-NEXT: %arrayidx.1 = getelementptr inbounds nuw i8, ptr %ptr, i64 4
16 // CHECK-NEXT: br label %for.cond1.preheader
18 // CHECK-NOT: @llvm.type.test
20 // The code below is a reduced case from https://github.com/llvm/llvm-project/issues/112053
21 #define __PRINTFLIKE(__fmt, __varargs) __attribute__((__format__(__printf__, __fmt, __varargs)))
22 typedef void func(void* arg
, const char* fmt
, ...) __PRINTFLIKE(2, 3);
23 typedef __SIZE_TYPE__
size_t;
24 typedef unsigned long uintptr_t;
27 void foo(const void* ptr
, size_t len
, long disp_addr
,
28 func
* printf_func
, void* printf_arg
) {
29 uintptr_t address
= (uintptr_t)ptr
;
32 for (count
= 0; count
< len
; count
+= 16) {
35 unsigned char cbuf
[16];
40 for (i
= 0; i
< s
/ 4; i
++) {
41 u
.buf
[i
] = ((const unsigned int*)address
)[i
];
42 printf_func(printf_arg
, "%08x ", static_cast<unsigned int>(u
.buf
[i
]));