Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / runtime / iplt.c
blobb0e2e6d250700c9a90af842b3954a98338844b91
1 // This test checks that the ifuncs works after bolt.
3 // RUN: %clang %cflags -no-pie %s -fuse-ld=lld \
4 // RUN: -o %t.exe -Wl,-q
5 // RUN: llvm-bolt %t.exe -o %t.bolt.exe --use-old-text=0 --lite=0
6 // RUN: %t.bolt.exe | FileCheck %s
8 // CHECK: foo
10 #include <stdio.h>
11 #include <string.h>
13 static void foo() { printf("foo\n"); }
15 static void *resolver_foo(void) { return foo; }
17 __attribute__((ifunc("resolver_foo"))) void ifoo();
19 static void *resolver_memcpy(void) { return memcpy; }
21 __attribute__((ifunc("resolver_memcpy"))) void *
22 imemcpy(void *dest, const void *src, size_t n);
24 int main() {
25 int a = 0xdeadbeef, b = 0;
26 imemcpy(&b, &a, sizeof(b));
27 if (a != b)
28 return -1;
30 ifoo();