Skip to content
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
11 changes: 11 additions & 0 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5432,6 +5432,17 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
if (BD && BD->isMoved())
return BD->getOutputAddress();

if (const BinaryFunction *BF =
BC->getBinaryFunctionContainingAddress(OldAddress)) {
if (BF->isEmitted()) {
BC->errs() << "BOLT-ERROR: unable to get new address corresponding to "
"input address 0x"
<< Twine::utohexstr(OldAddress) << " in function " << *BF
<< ". Consider adding this function to --skip-funcs=...\n";
exit(1);
}
}

return 0;
}

Expand Down
16 changes: 16 additions & 0 deletions bolt/test/X86/indirect-goto-pie.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Check that llvm-bolt fails to process PIC binaries with computed goto, as the
# support is not there yet for correctly updating dynamic relocations
# referencing code inside functions.

REQUIRES: x86_64-linux

RUN: %clang %S/Inputs/indirect_goto.c -o %t -fpic -pie -Wl,-q
RUN: not llvm-bolt %t -o %t.bolt --relocs=1 --print-cfg --print-only=main \
RUN: |& FileCheck %s

# Check that processing works if main() is skipped.
RUN: llvm-bolt %t -o %t.bolt --relocs=1 --skip-funcs=main

CHECK: jmpq *%rax # UNKNOWN CONTROL FLOW

CHECK: BOLT-ERROR: unable to get new address
2 changes: 1 addition & 1 deletion bolt/test/X86/shrinkwrapping-do-not-pessimize.s
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ end_if_1:
.size _start, .-_start

.data
rel: .quad end_if_1
rel: .quad _start

# CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops
18 changes: 0 additions & 18 deletions bolt/test/runtime/X86/Inputs/indirect_goto.c

This file was deleted.

10 changes: 0 additions & 10 deletions bolt/test/runtime/X86/indirect-goto-pie.test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's XFAIL it instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even with a fix this test will fail. Need a better test case or fix this one once the support is there.

This file was deleted.