File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1514,6 +1514,12 @@ void RewriteInstance::registerFragments() {
1514
1514
}
1515
1515
if (BD) {
1516
1516
BinaryFunction *BF = BC->getFunctionForSymbol (BD->getSymbol ());
1517
+ if (BF == &Function) {
1518
+ BC->errs ()
1519
+ << " BOLT-WARNING: fragment maps to the same function as parent: "
1520
+ << Function << ' \n ' ;
1521
+ continue ;
1522
+ }
1517
1523
if (BF) {
1518
1524
BC->registerFragment (Function, *BF);
1519
1525
continue ;
Original file line number Diff line number Diff line change
1
+ ## This test reproduces the issue where a fragment has the same address as
2
+ ## parent function.
3
+ # RUN: llvm - mc -- filetype=obj -- triple x86_64 - unknown - unknown %s - o %t.o
4
+ # RUN: %clang %cflags %t.o - o %t
5
+ # RUN: llvm - bolt %t - o %t. out 2 >& 1 | FileCheck %s
6
+ # CHECK: BOLT - WARNING: fragment maps to the same function as parent: main/ 1 ( * 2 )
7
+ .type main , @function
8
+ .type main.cold , @function
9
+ main.cold:
10
+ main:
11
+ ret
12
+ .size main , . - main
13
+ .size main.cold , . - main.cold
You can’t perform that action at this time.
0 commit comments