Skip to content

[BOLT,test] Link against a shared object to test PLT #125625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bolt/test/AArch64/exceptions-plt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

// REQUIRES: system-linux

// RUN: %clangxx %cxxflags -O1 -Wl,-q,-znow %s -o %t.exe
// RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
// Link against a DSO to ensure PLT entries.
// RUN: %clangxx %cxxflags -O1 -Wl,-q,-znow %s %t.so -o %t.exe
// RUN: llvm-bolt %t.exe -o %t.bolt.exe --plt=all --print-only=.*main.* \
// RUN: --print-finalized 2>&1 | FileCheck %s

Expand Down
4 changes: 3 additions & 1 deletion bolt/test/AArch64/plt-call.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Verify that PLTCall optimization works.

RUN: %clang %cflags %p/../Inputs/plt-tailcall.c \
RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
// Link against a DSO to ensure PLT entries.
RUN: %clang %cflags %p/../Inputs/plt-tailcall.c %t.so \
RUN: -o %t -Wl,-q
RUN: llvm-bolt %t -o %t.bolt --plt=all --print-plt --print-only=foo | FileCheck %s

Expand Down
4 changes: 3 additions & 1 deletion bolt/test/X86/callcont-fallthru.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## Ensures that a call continuation fallthrough count is set when using
## pre-aggregated perf data.

# RUN: %clangxx %cxxflags %s -o %t -Wl,-q -nostdlib
# RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
## Link against a DSO to ensure PLT entries.
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
# RUN: link_fdata %s %t %t.pa1 PREAGG
# RUN: link_fdata %s %t %t.pa2 PREAGG2
# RUN: link_fdata %s %t %t.pa3 PREAGG3
Expand Down
4 changes: 3 additions & 1 deletion bolt/test/X86/cfi-instrs-reordered.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o
# RUN: llvm-strip --strip-unneeded %t.o
# RUN: %clangxx %cflags %t.o -o %t.exe
# RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
## Link against a DSO to ensure PLT entries.
# RUN: %clangxx %cflags %t.o %t.so -o %t.exe
# RUN: llvm-bolt %t.exe -o %t --reorder-blocks=cache --print-after-lowering \
# RUN: --print-only=_Z10SolveCubicddddPiPd 2>&1 | FileCheck %s
#
Expand Down
4 changes: 3 additions & 1 deletion bolt/test/X86/plt-call.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Verify that PLTCall optimization works.

RUN: %clang %cflags %p/../Inputs/plt-tailcall.c \
RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
// Link against a DSO to ensure PLT entries.
RUN: %clang %cflags %p/../Inputs/plt-tailcall.c %t.so \
RUN: -o %t -Wl,-q
RUN: llvm-bolt %t -o %t.bolt --plt=all --print-plt --print-only=foo | FileCheck %s

Expand Down
4 changes: 3 additions & 1 deletion bolt/test/runtime/exceptions-plt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

// REQUIRES: system-linux

// RUN: %clangxx %cxxflags -O1 -Wl,-q,-znow %s -o %t.exe
// RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so
// Link against a DSO to ensure PLT entries.
// RUN: %clangxx %cxxflags -O1 -Wl,-q,-znow %s %t.so -o %t.exe
// RUN: llvm-bolt %t.exe -o %t.bolt.exe --plt=all
// RUN: %t.bolt.exe

Expand Down
7 changes: 4 additions & 3 deletions bolt/test/runtime/plt-lld.test
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// This test checks that the pointers to PLT are properly updated.
// The test is using lld linker.
// The test uses lld and links against a DSO to ensure PLT entries.
RUN: %clang %cflags -fpic -shared -xc /dev/null -o %t.so

// Non-PIE:
RUN: %clang %cflags -no-pie %p/../Inputs/plt.c -fuse-ld=lld \
RUN: %clang %cflags -no-pie %p/../Inputs/plt.c %t.so -fuse-ld=lld \
RUN: -o %t.lld.exe -Wl,-q
RUN: llvm-bolt %t.lld.exe -o %t.lld.bolt.exe --use-old-text=0 --lite=0
RUN: %t.lld.bolt.exe | FileCheck %s

// PIE:
RUN: %clang %cflags -fPIC -pie %p/../Inputs/plt.c -fuse-ld=lld \
RUN: %clang %cflags -fPIC -pie %p/../Inputs/plt.c %t.so -fuse-ld=lld \
RUN: -o %t.lld.pie.exe -Wl,-q
RUN: llvm-bolt %t.lld.pie.exe -o %t.lld.bolt.pie.exe --use-old-text=0 --lite=0
RUN: %t.lld.bolt.pie.exe | FileCheck %s
Expand Down