1 // This test checks that the ifuncs works after bolt.
2 // Compiling with 00 results in IFUNC indirect calling.
4 // RUN: %clang %cflags -O0 -no-pie %s -fuse-ld=lld \
5 // RUN: -o %t.exe -Wl,-q
6 // RUN: llvm-bolt %t.exe -o %t.bolt.exe --use-old-text=0 --lite=0
7 // RUN: %t.bolt.exe | FileCheck %s
9 // RUN: %clang %cflags -O3 -no-pie %s -fuse-ld=lld \
10 // RUN: -o %t.O3.exe -Wl,-q
11 // RUN: llvm-bolt %t.O3.exe -o %t.O3.bolt.exe --use-old-text=0 --lite=0
12 // RUN: %t.O3.bolt.exe | FileCheck %s
19 static void foo() { printf("foo\n"); }
21 static void *resolver_foo(void) { return foo
; }
23 __attribute__((ifunc("resolver_foo"))) void ifoo();
25 static void *resolver_memcpy(void) { return memcpy
; }
27 __attribute__((ifunc("resolver_memcpy"))) void *
28 imemcpy(void *dest
, const void *src
, size_t n
);
31 int a
= 0xdeadbeef, b
= 0;
32 imemcpy(&b
, &a
, sizeof(b
));