BOLT
BOLT copied to clipboard
BOLT-ERROR: PC-relative operand can't be evaluated:
I am trying to run SPEC CPU 2017
rate runs, using llvm-bolt
for which I am trying to generate the bolt cfg specifically for the ICC binaries.
Here's how I am running it.
llvm-bolt -update-debug-sections -print-cfg=1 perlbench_r_base.ic20.ROME-BOLT -o icc.bolt > icc.cfg
I get a few errors as
BOLT-WARNING: split function detected on input : __assert_fail_base.cold/1. The support is limited in relocation mode.
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat47d47f. Skipping.
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat4b1869. Skipping.
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat4b1882. Skipping.
BOLT-ERROR: symbol seen in the middle of the function __BOLT_FDE_FUNCat4b1903. Skipping.
BOLT-ERROR: PC-relative operand can't be evaluated:
**movq %cs:0xf3700(%rip), %r8**
<MCInst #1784 MOV64rm <MCOperand Reg:128> <MCOperand Reg:55> <MCOperand Imm:1> <MCOperand Reg:0> <MCOperand Imm:997120> <MCOperand Reg:12>>
BOLT-ERROR: cannot handle PC-relative operand at 0x4016d6. Skipping function flow_cost/1(*2).
Below flags were added to the SPEC config specifically for running with bolt.
BOLT_FLAGS = -g -Wl,-emit-relocs -fno-inline-functions
Debugging the error, seems to come from BinaryFunction::disassemble()
function, which flags that there could be potential error in disassembling it at MC layer from the error.
- Can there be more inputs and details on what's going wrong here?
- Is it the compiled binary which has issues ?
- or is there any issue with disassembling in BOLT ?
I also also verified the rela.txt
in binary.
readelf perlbench_r_base.ic20.ROME-BOLT -S | grep "rela"
[10] .rela.dyn RELA 0000000000401c68 00001c68
[11] .rela.plt RELA 0000000000401d70 00001d70
[29] .rela.text RELA 0000000000000000 00287eb0
[30] .rela.eh_frame RELA 0000000000000000 003b35b0
[31] .rela.init RELA 0000000000000000 003c4170
[33] .rela.data RELA 0000000000000000 003c41f0
[34] .rela.fini_array RELA 0000000000000000 003c6b60
[35] .rela.init_array RELA 0000000000000000 003c6b78
[42] .rela.rodata RELA 0000000000000000 00771840
[43] .rela.debug_loc RELA 0000000000000000 007db6f8
[44] .rela.debug_info RELA 0000000000000000 0083f568
[45] .rela.debug_range RELA 0000000000000000 00afa940
[46] .rela.debug_line RELA 0000000000000000 00b6dae0
[47] .rela.data.rel.ro RELA 0000000000000000 00b7d518
[48] .rela.data.rel.ro RELA 0000000000000000 00b7dae8
Thanks again for helping for all the related queries.
Soft reminder/ping !
I have a good idea on what's going on. The problem is related to the disassembly of the instruction that you see in the dump. I believe the code is specific to ICC. You can try to manually disable processing of the function containing the instruction with -skip-funcs=
option, while I'm working on the fix.
You mention that you've added -fno-inline-functions
option specifically for BOLT. Why is that?
It was to disable function in-lining for optimizations and to be explicit and not have optimizations triggered, we are working on an internal use-case[1] for performance measurement using great framework which BOLT provides at binary and MC layer of LLVM.
[1] https://lists.llvm.org/pipermail/llvm-dev/2020-October/145915.html
Thanks for looking into the issue.