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
6 changes: 6 additions & 0 deletions bolt/lib/Rewrite/RewriteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,12 @@ void RewriteInstance::registerFragments() {
}
if (BD) {
BinaryFunction *BF = BC->getFunctionForSymbol(BD->getSymbol());
if (BF == &Function) {
BC->errs()
<< "BOLT-WARNING: fragment maps to the same function as parent: "
<< Function << '\n';
continue;
}
if (BF) {
BC->registerFragment(Function, *BF);
continue;
Expand Down
13 changes: 13 additions & 0 deletions bolt/test/X86/fragment-alias.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## This test reproduces the issue where a fragment has the same address as
## parent function.
# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags %t.o -o %t
# RUN: llvm-bolt %t -o %t.out 2>&1 | FileCheck %s
# CHECK: BOLT-WARNING: fragment maps to the same function as parent: main/1(*2)
.type main, @function
.type main.cold, @function
main.cold:
main:
ret
.size main, .-main
.size main.cold, .-main.cold
Loading