48 lines · plain
1// Check if BOLT can process ifunc symbols from .plt section2// RUN: %clang %cflags -nostdlib -no-pie %p/../Inputs/ifunc.c -fuse-ld=lld \3// RUN: -o %t.exe -Wl,-q4// RUN: llvm-bolt %t.exe -o %t.bolt.exe \5// RUN: --print-disasm --print-only=_start | \6// RUN: FileCheck --check-prefix=CHECK %s7// RUN: llvm-readelf -aW %t.bolt.exe | \8// RUN: FileCheck --check-prefix=REL_CHECK %s9 10// Check if BOLT can process ifunc symbols from .plt section in non-pie static11// executable case.12// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -no-pie \13// RUN: -o %t.nopie.exe -Wl,-q14// RUN: llvm-readelf -l %t.nopie.exe | \15// RUN: FileCheck --check-prefix=NON_DYN_CHECK %s16// RUN: llvm-bolt %t.nopie.exe -o %t.nopie.bolt.exe \17// RUN: --print-disasm --print-only=_start | \18// RUN: FileCheck --check-prefix=CHECK %s19// RUN: llvm-readelf -aW %t.nopie.bolt.exe | \20// RUN: FileCheck --check-prefix=REL_CHECK %s21 22// Check if BOLT can process ifunc symbols from .plt section in pie executable23// case.24// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \25// RUN: -o %t.pie.exe -Wl,-q26// RUN: llvm-bolt %t.pie.exe -o %t.pie.bolt.exe \27// RUN: --print-disasm --print-only=_start | \28// RUN: FileCheck --check-prefix=CHECK %s29// RUN: llvm-readelf -aW %t.pie.bolt.exe | \30// RUN: FileCheck --check-prefix=REL_CHECK %s31 32// Check that IPLT trampoline located in .plt section are normally handled by33// BOLT. The gnu-ld linker doesn't use separate .iplt section.34// RUN: %clang %cflags -nostdlib %p/../Inputs/ifunc.c -fuse-ld=lld -fPIC -pie \35// RUN: -T %p/../Inputs/iplt.ld -o %t.iplt_pie.exe -Wl,-q36// RUN: llvm-bolt %t.iplt_pie.exe -o %t.iplt_pie.bolt.exe \37// RUN: --print-disasm --print-only=_start | \38// RUN: FileCheck --check-prefix=CHECK %s39// RUN: llvm-readelf -aW %t.iplt_pie.bolt.exe | \40// RUN: FileCheck --check-prefix=REL_CHECK %s41 42// NON_DYN_CHECK-NOT: DYNAMIC43 44// CHECK: callq "resolver_foo/1@PLT"45 46// REL_CHECK: R_X86_64_IRELATIVE [[#%x,REL_SYMB_ADDR:]]47// REL_CHECK: [[#REL_SYMB_ADDR]] {{.*}} FUNC {{.*}} resolver_foo48