[llvm] [BOLT] Support map other function entry address (PR #101466)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 03:15:39 PDT 2024


linsinan1995 wrote:

take the assembly code attached in the test as an example
```
    .text
    .type   chain, @function
chain:
    movq    $1, %rax
Lable:
    ret
    .size   chain, .-chain
    .type   _start, @function
    .global _start
_start:
    jmpq    *.Lfoo(%rip)
    ret
    .size   _start, .-_start
  .data
.Lfoo:
  .quad Lable
```

(1) if -no-pie, there is not a dynamic relocation for `Label`, then everything is fine.
```
gcc test.s -nostdlib -nodefaultlibs -Wl,-q
llvm-bolt a.out -o a.opt
```

(2) if it is pie, then an error occurs
```
gcc test.s -nostdlib -nodefaultlibs -Wl,-q -fPIC -fPIE -pie
llvm-bolt a.out -o a.opt
```

BOLT-ERROR: unable to get new address corresponding to input address 0x1007 in function chain/1(*2). Consider adding this function to --skip-funcs=...

This change can make the case (2) work

https://github.com/llvm/llvm-project/pull/101466


More information about the llvm-commits mailing list