Issue |
146542
|
Summary |
[BUG][RISCV][BOLT] Incorrect GOT Relocation Handling in some case
|
Labels |
BOLT
|
Assignees |
|
Reporter |
dinyy
|
I use the newest version clang and gcc(main branch ) to complie mysql-8.0.33. And bolt failed to deal with mysql. When I run this command:
> llvm-bolt mysqld -o mysqld.test
It occuers that:
> Segmentation fault
After use gdb to debug , I found that R_RISCV_GOT_HI20 Relocation Handling failed .
Bolt think when occur GOT relocation infomation , always find 2 instruction to get imm, and transform the symbole to __BOLT_got_zero + offset , the code is in `bolt\lib\Core\BinaryFunction.cpp` and `bolt\lib\Core\Relocation.cpp.` To deal with this case:
> 2242d12: 01620797 auipc a5,0x1620
2242d12: R_RISCV_GOT_HI20 _ITM_deregisterTMCloneTable
2242d12: R_RISCV_RELAX *ABS*
2242d16: 7de7b783 ld a5,2014(a5) # 38634f0 <_ITM_deregisterTMCloneTable@Base>
but the mysqld binary which is compiled by newest clang and gcc , will occur this case:
> 0000000002244c08 <.Lpcrel_hi153>:
2244c08: 01621617 auipc a2,0x1621
2244c08: R_RISCV_GOT_HI20 connection_events_loop_aborted_flag
2244c0c: 66a1 **lui a3,0x8**
0000000002244c0e <.Lpcrel_hi154>:
2244c0e: 01621717 auipc a4,0x1621
2244c0e: R_RISCV_GOT_HI20 log_output_options
0000000002244c12 <.Lpcrel_hi155>:
2244c12: 01621797 auipc a5,0x1621
2244c12: R_RISCV_GOT_HI20 query_logger
2244c16: f2a50b93 addi s7,a0,-214 # 3c09b28 <.L_MergedGlobals.1012>
2244c16: R_RISCV_PCREL_LO12_I .Lpcrel_hi151
2244c16: R_RISCV_RELAX *ABS*
2244c1a: d2458d93 addi s11,a1,-732 # fb9928 <.LJTI30_0>
2244c1a: R_RISCV_PCREL_LO12_I .Lpcrel_hi152
2244c1a: R_RISCV_RELAX *ABS*
I try to fix it by find auipc+ld pattern when the relocation is about GOT in `bolt\lib\Core\BinaryFunction.cpp` ,but failed. Now I need some help to fix this bug. Could someone help me?
And I want to use `bolt/utils/bughunter.sh` on RISCV , but failed. It couldn't work because `createRelocation` and `encodeValueRISCV` not implemented. Are there any way to trace the bug?
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs