Skip to content

Commit 2ec56d3

Browse files
committed
add isInConstantIsland for scanExternalRefs
1 parent d30bd27 commit 2ec56d3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,9 +1699,19 @@ bool BinaryFunction::scanExternalRefs() {
16991699

17001700
const uint64_t FunctionOffset =
17011701
TargetAddress - TargetFunction->getAddress();
1702-
BranchTargetSymbol =
1703-
FunctionOffset ? TargetFunction->addEntryPointAtOffset(FunctionOffset)
1704-
: TargetFunction->getSymbol();
1702+
if (!TargetFunction->isInConstantIsland(TargetAddress)) {
1703+
BranchTargetSymbol =
1704+
FunctionOffset ? TargetFunction->addEntryPointAtOffset(FunctionOffset)
1705+
: TargetFunction->getSymbol();
1706+
} else {
1707+
TargetFunction->setIgnored();
1708+
Success = false;
1709+
BC.outs() << "BOLT-WARNING: Ignoring entry point at address 0x"
1710+
<< Twine::utohexstr(Address)
1711+
<< " in constant island of function " << *TargetFunction
1712+
<< '\n';
1713+
break;
1714+
}
17051715
}
17061716

17071717
// Can't find more references. Not creating relocations since we are not

bolt/test/AArch64/constant-island-entry.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
55
# RUN: %clang %cflags %t.o -pie -Wl,-q -o %t.exe
66
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
7+
# RUN: llvm-bolt %t.exe -o %t.bolt -skip-funcs=caller 2>&1 | FileCheck %s
78

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

0 commit comments

Comments
 (0)