File tree Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Original file line number Diff line number Diff line change @@ -5569,14 +5569,10 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
55695569 if (const BinaryFunction *BF =
55705570 BC->getBinaryFunctionContainingAddress (OldAddress)) {
55715571 if (BF->isEmitted ()) {
5572- // If OldAddress is the another entry point of
5573- // the function, then BOLT could get the new address.
5574- if (BF->isMultiEntry ()) {
5575- for (const BinaryBasicBlock &BB : *BF)
5576- if (BB.isEntryPoint () &&
5577- (BF->getAddress () + BB.getOffset ()) == OldAddress)
5578- return BF->getOutputAddress () + BB.getOffset ();
5579- }
5572+ for (const BinaryBasicBlock &BB : *BF)
5573+ if ((BF->getAddress () + BB.getOffset ()) == OldAddress)
5574+ return BB.getOutputStartAddress ();
5575+
55805576 BC->errs () << " BOLT-ERROR: unable to get new address corresponding to "
55815577 " input address 0x"
55825578 << Twine::utohexstr (OldAddress) << " in function " << *BF
Original file line number Diff line number Diff line change 1+ # RUN: llvm - mc - filetype=obj - triple aarch64 - unknown - unknown %s - o %t.o
2+ # RUN: %clang %cflags %t.o - o %t.exe - Wl ,- q
3+ # RUN: llvm - bolt %t.exe - o %t.bolt 2 >& 1 | FileCheck %s
4+
5+ # Before bolt could handle mapping addresses within moved functions , it
6+ # would bail out with an error of the form:
7+ # BOLT - ERROR: unable to get new address corresponding to input address 0x10390 in function main. Consider adding this function to -- skip - funcs=...
8+ # These addresses arise if computed GOTO is in use.
9+ # Check th at bolt does not emit any error.
10+
11+ # CHECK - NOT : BOLT - ERROR
12+
13+ .globl main
14+ .p2align 2
15+ .type main , @function
16+ main:
17+ .cfi_startproc
18+ adrp x8 , .L__const.main.ptrs + 8
19+ add x8 , x8 , :lo12:.L__const.main.ptrs + 8
20+ ldr x9 , [ x8 ], # 8
21+ br x9
22+
23+ .Label0: // Block address taken
24+ ldr x9 , [ x8 ], # 8
25+ br x9
26+
27+ .Label1: // Block address taken
28+ mov w0 , # 42
29+ ret
30+
31+ .Lfunc_end0:
32+ .size main , .Lfunc_end0 - main
33+ .cfi_endproc
34+ .type .L__const.main.ptrs , @object
35+ . section .data.rel.ro , "aw" , @progbits
36+ .p2align 3 , 0x0
37+ .L__const.main.ptrs:
38+ .xword .Label0
39+ .xword .Label1
You can’t perform that action at this time.
0 commit comments