[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / bolt / test / runtime / iplt.c
blobd5b56d901e6227d90bfb210683bd3883145d5210
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
14 // CHECK: foo
16 #include <stdio.h>
17 #include <string.h>
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);
30 int main() {
31 int a = 0xdeadbeef, b = 0;
32 imemcpy(&b, &a, sizeof(b));
33 if (a != b)
34 return -1;
36 ifoo();