1 // With -O0 indirect call is performed on IPLT trampoline. IPLT trampoline
3 // RUN: %clang %cflags -nostdlib -O0 -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \
4 // RUN: -o %t.O0.exe -Wl,-q
5 // RUN: llvm-bolt %t.O0.exe -o %t.O0.bolt.exe \
6 // RUN: --print-disasm --print-only=_start | \
7 // RUN: FileCheck --check-prefix=CHECK %s
8 // RUN: llvm-readelf -aW %t.O0.bolt.exe | \
9 // RUN: FileCheck --check-prefix=REL_CHECK %s
11 // Non-pie static executable doesn't generate PT_DYNAMIC, check relocation
12 // is readed successfully and IPLT trampoline has been identified by bolt.
13 // RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -no-pie \
14 // RUN: -o %t.O3_nopie.exe -Wl,-q
15 // RUN: llvm-readelf -l %t.O3_nopie.exe | \
16 // RUN: FileCheck --check-prefix=NON_DYN_CHECK %s
17 // RUN: llvm-bolt %t.O3_nopie.exe -o %t.O3_nopie.bolt.exe \
18 // RUN: --print-disasm --print-only=_start | \
19 // RUN: FileCheck --check-prefix=CHECK %s
20 // RUN: llvm-readelf -aW %t.O3_nopie.bolt.exe | \
21 // RUN: FileCheck --check-prefix=REL_CHECK %s
23 // With -O3 direct call is performed on IPLT trampoline. IPLT trampoline
24 // doesn't have associated symbol. The ifunc symbol has the same address as
25 // IFUNC resolver function.
26 // RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
27 // RUN: -o %t.O3_pie.exe -Wl,-q
28 // RUN: llvm-bolt %t.O3_pie.exe -o %t.O3_pie.bolt.exe \
29 // RUN: --print-disasm --print-only=_start | \
30 // RUN: FileCheck --check-prefix=CHECK %s
31 // RUN: llvm-readelf -aW %t.O3_pie.bolt.exe | \
32 // RUN: FileCheck --check-prefix=REL_CHECK %s
34 // Check that IPLT trampoline located in .plt section are normally handled by
35 // BOLT. The gnu-ld linker doesn't use separate .iplt section.
36 // RUN: %clang %cflags -nostdlib -O3 %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \
37 // RUN: -T %p/../Inputs/iplt.ld -o %t.iplt_O3_pie.exe -Wl,-q
38 // RUN: llvm-bolt %t.iplt_O3_pie.exe -o %t.iplt_O3_pie.bolt.exe \
39 // RUN: --print-disasm --print-only=_start | \
40 // RUN: FileCheck --check-prefix=CHECK %s
41 // RUN: llvm-readelf -aW %t.iplt_O3_pie.bolt.exe | \
42 // RUN: FileCheck --check-prefix=REL_CHECK %s
44 // NON_DYN_CHECK-NOT: DYNAMIC
46 // CHECK: {{(bl? "(resolver_foo|ifoo).*@PLT"|adr x[0-9]+, ifoo)}}
48 // REL_CHECK: R_AARCH64_IRELATIVE [[#%x,REL_SYMB_ADDR:]]
49 // REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo