Issue 129518
Summary [bolt][relocation] In rewiteInstance, an error relocation is generated
Labels BOLT
Assignees
Reporter WangJee
    In the RISC V architecture, when rewirteInstance.cpp processes relocation, In the following code, the final value of the variable Value is 0x004006B7ffb08617, as shown in the following assembly, which is two consecutive instructions; but the auip and load instructions in this program are not two consecutive instructions, their correct values ​​should be 0x0044e63603ffb08617, so the relocation result is incorrect, which eventually leads to segmentation failure.

```
ErrorOr<uint64_t> Value =
      BC->getUnsignedValueAtAddress(Rel.getOffset(), RelSize);
```
  
```
**_7bde24: ffb08617     	auipc	a2, 0xffb08_**
  7bde28: 004006b7     	lui	a3, 0x400
  7bde2c: ffbc0597     	auipc	a1, 0xffbc0
  7bde30: ff8c9717     	auipc	a4, 0xff8c9
  7bde34: ff8c9797     	auipc	a5, 0xff8c9
  7bde38: fd070713     	addi	a4, a4, -0x30
  7bde3c: cdb87057     	vsetivli	zero, 0x10, e64, m8, ta, ma
  7bde40: 02077407     	vle64.v	v8, (a4)
  7bde44: 5cc58593     	addi	a1, a1, 0x5cc
  7bde48: 04c78713     	addi	a4, a5, 0x4c
  7bde4c: 08058793     	addi	a5, a1, 0x80
  7bde50: 0207f427     	vse64.v	v8, (a5)
  7bde54: 02077407     	vle64.v	v8, (a4)
  7bde58: ff8c9717     	auipc	a4, 0xff8c9
  _**7bde5c: 44e63603     	ld	a2, 0x44e(a2)**_
  7bde60: 10058793     	addi	a5, a1, 0x100
  7bde64: 0207f427     	vse64.v	v8, (a5)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to