brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 15ecc35 Raw
50 lines · plain
1// With -O0 indirect call is performed on IPLT trampoline. IPLT trampoline2// has IFUNC symbol.3// RUN: %clang %cflags -nostdlib -O0 -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \4// RUN:    -o %t.O0.exe -Wl,-q5// RUN: llvm-bolt %t.O0.exe -o %t.O0.bolt.exe \6// RUN:   --print-disasm --print-only=_start | \7// RUN:   FileCheck --check-prefix=CHECK %s8// RUN: llvm-readelf -aW %t.O0.bolt.exe | \9// RUN:   FileCheck --check-prefix=REL_CHECK %s10 11// Non-pie static executable doesn't generate PT_DYNAMIC, check relocation12// is read 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,-q15// RUN: llvm-readelf -l %t.O3_nopie.exe | \16// RUN:   FileCheck --check-prefix=NON_DYN_CHECK %s17// 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 %s20// RUN: llvm-readelf -aW %t.O3_nopie.bolt.exe | \21// RUN:   FileCheck --check-prefix=REL_CHECK %s22 23// With -O3 direct call is performed on IPLT trampoline. IPLT trampoline24// doesn't have associated symbol. The ifunc symbol has the same address as25// 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,-q28// 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 %s31// RUN: llvm-readelf -aW %t.O3_pie.bolt.exe | \32// RUN:   FileCheck --check-prefix=REL_CHECK %s33 34// Check that IPLT trampoline located in .plt section are normally handled by35// 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,-q38// 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 %s41// RUN: llvm-readelf -aW %t.iplt_O3_pie.bolt.exe | \42// RUN:   FileCheck --check-prefix=REL_CHECK %s43 44// NON_DYN_CHECK-NOT: DYNAMIC45 46// CHECK: {{(bl? "(resolver_foo|ifoo).*@PLT"|adr x[0-9]+, ifoo)}}47 48// REL_CHECK: R_AARCH64_IRELATIVE [[#%x,REL_SYMB_ADDR:]]49// REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo50