[lld] [lld][ELF] Fix a corner case of elf::getLoongArchPageDelta (PR #71907)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 19 01:02:14 PST 2023


SixWeining wrote:

> Another corner case?
> 
> DEST: 0 PC: 0x80000ffc
> 
> ```
> 80000ffc: 05 00 00 1b  	pcalau12i	$a1, -524288
> 80001000: 04 00 c0 02  	addi.d	$a0, $zero, 0
> 80001004: e4 ff ff 17  	lu32i.d	$a0, -1
> 80001008: 84 fc 3f 03  	lu52i.d	$a0, $a0, -1
> 8000100c: 84 94 10 00  	add.d	$a0, $a0, $a1
> ```
> 
> ugly test: https://gist.github.com/heiher/3c7a2a9e7d05354e818b50d69e40b8cb

ld is correct in this case.

```
    80000ffc:   1b000004        pcalau12i       $a0, -524288(0x80000)
    80001000:   02c00001        addi.d          $ra, $zero, 0
    80001004:   16000001        lu32i.d         $ra, 0
    80001008:   03000021        lu52i.d         $ra, $ra, 0
    8000100c:   00109021        add.d           $ra, $ra, $a0
```

@MQ-mengqing Can you post an example you mentioned in https://github.com/rui314/mold/issues/1131#issuecomment-1771892552 ?

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


More information about the llvm-commits mailing list