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
16 changes: 13 additions & 3 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,9 +1699,19 @@ bool BinaryFunction::scanExternalRefs() {

const uint64_t FunctionOffset =
TargetAddress - TargetFunction->getAddress();
BranchTargetSymbol =
FunctionOffset ? TargetFunction->addEntryPointAtOffset(FunctionOffset)
: TargetFunction->getSymbol();
if (!TargetFunction->isInConstantIsland(TargetAddress)) {
BranchTargetSymbol =
FunctionOffset
? TargetFunction->addEntryPointAtOffset(FunctionOffset)
: TargetFunction->getSymbol();
} else {
TargetFunction->setIgnored();
BC.outs() << "BOLT-WARNING: Ignoring entry point at address 0x"
<< Twine::utohexstr(Address)
<< " in constant island of function " << *TargetFunction
<< '\n';
continue;
}
}

// Can't find more references. Not creating relocations since we are not
Expand Down
9 changes: 7 additions & 2 deletions bolt/test/AArch64/constant-island-entry.s
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// This test checks that we ignore functions which add an entry point that
// is in a constant island.
## This test checks that we ignore functions which add an entry point that
## is in a constant island.

# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags %t.o -pie -Wl,-q -o %t.exe

## Check when the caller is successfully disassembled.
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s

## Skip caller to check the identical warning is triggered from ScanExternalRefs().
# RUN: llvm-bolt %t.exe -o %t.bolt -skip-funcs=caller 2>&1 | FileCheck %s

# CHECK: BOLT-WARNING: Ignoring entry point at address 0x{{[0-9a-f]+}} in constant island of function func

.globl func
Expand Down
Loading