File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -5509,6 +5509,14 @@ uint64_t RewriteInstance::getNewFunctionOrDataAddress(uint64_t OldAddress) {
55095509  if  (const  BinaryFunction *BF =
55105510          BC->getBinaryFunctionContainingAddress (OldAddress)) {
55115511    if  (BF->isEmitted ()) {
5512+       //  If OldAddress is the another entry point of
5513+       //  the function, then BOLT could get the new address.
5514+       if  (BF->isMultiEntry ()) {
5515+         for  (auto  &BB : *BF)
5516+           if  (BB.isEntryPoint () &&
5517+               (BF->getAddress () + BB.getOffset ()) == OldAddress)
5518+             return  BF->getOutputAddress () + BB.getOffset ();
5519+       }
55125520      BC->errs () << " BOLT-ERROR: unable to get new address corresponding to " 
55135521                    " input address 0x" 
55145522                 << Twine::utohexstr (OldAddress) << "  in function " 
Original file line number Diff line number Diff line change 1+ // This test examines whether BOLT can correctly update when 
2+ // dynamic relocation points to other entry points of the 
3+ // function. 
4+ 
5+ # RUN: %clang %cflags -fPIC -pie %s -o %t.exe -nostdlib -Wl,-q 
6+ # RUN: llvm-bolt %t.exe -o %t.bolt | FileCheck %s 
7+ 
8+     .text 
9+     .type    chain, @function 
10+ chain: 
11+     movq     $1 , %rax 
12+ Lable: 
13+     ret 
14+     .size    chain, .-chain
15+     .type    _start, @function 
16+     .global  _start
17+ _start: 
18+     jmpq     *.Lfoo(%rip )
19+     ret 
20+     .size    _start, .-_start
21+   .data 
22+ .Lfoo: 
23+   .quad  Lable
24+ 
25+ # CHECK-NOT: BOLT-ERROR 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments