3 ms·
I think there's an error in the Position Independence section: start: auipc a0, 3 addi a0, a0, 4 The text says that this should result in
by cbm-vic-20 1y ago
I think there's an error in the Position Independence section:
start:
auipc a0, 3
addi a0, a0, 4
The text says that this should result in 0x3004; was this example intended to be
start:
lui a0, 3
addi a0, a0, 4
- brucehoult 1y agoNo, because `lui` results in an absolute address, not a position independent one. The `auipc/addi` sequence results in 0x3004 + whatever the address of the `auipc` instruction itself is. If the `auipc` is at address 0 then the result will be the same.
- jecel 1y agoExactly, but the text has the same instruction sequence twice and the parent correctly indicated that the first copy should have used "lui" to illustrate the problem you mentioned and the second copy does use "auipc" to illustrate the fix you mentioned.
- brucehoult 1y agoOh, fair enough.
- brucehoult 1y agoThis copypasta has been fixed.