Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
13 changes: 11 additions & 2 deletions bolt/lib/Core/BinaryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1336,8 +1336,17 @@ void BinaryContext::processInterproceduralReferences() {
<< Function.getPrintName() << " and "
<< TargetFunction->getPrintName() << '\n';
}
if (uint64_t Offset = Address - TargetFunction->getAddress())
TargetFunction->addEntryPointAtOffset(Offset);
if (uint64_t Offset = Address - TargetFunction->getAddress()) {
if (!TargetFunction->isInConstantIsland(Address)) {
TargetFunction->addEntryPointAtOffset(Offset);
} else {
TargetFunction->setIgnored();
this->outs() << "BOLT-WARNING: Ignoring entry point at address 0x"
<< Twine::utohexstr(Address)
<< " in constant island of function " << *TargetFunction
<< '\n';
}
}

continue;
}
Expand Down
35 changes: 35 additions & 0 deletions bolt/test/AArch64/constant-island-entry.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// This test checks that we ignore functions which add an entry point that
// is in a costant 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
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s

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

.globl func
.type func, %function
func:
ret
nop
b .Lafter_constant

.type constant_island, %object
constant_island:
.xword 0xabcdef

.Lafter_constant:
ret
.size func, .-func

.globl caller
.type caller, %function
caller:
bl constant_island
ret

.globl main
.type main, %function
main:
bl caller
ret
Loading