Skip to content

Commit 0b280fe

Browse files
committed
add isInConstantIsland for scanExternalRefs
1 parent d30bd27 commit 0b280fe

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,9 +1699,20 @@ 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
1705+
? TargetFunction->addEntryPointAtOffset(FunctionOffset)
1706+
: TargetFunction->getSymbol();
1707+
} else {
1708+
TargetFunction->setIgnored();
1709+
Success = false;
1710+
BC.outs() << "BOLT-WARNING: Ignoring entry point at address 0x"
1711+
<< Twine::utohexstr(Address)
1712+
<< " in constant island of function " << *TargetFunction
1713+
<< '\n';
1714+
break;
1715+
}
17051716
}
17061717

17071718
// 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)