Commit b43debd
committed
riscv-elf: Use simpler equivalent expression for LO12 relocations
Since LO12 only uses the low 12 bits of the value, subtracting a value
that's left-shifted by 12 cannot possibly have any effect. All this did
was sign-extend the value of lo12 from bit 12 upwards, which isn't
particularly useful, and just leads to confusion, since this unnecessary
(and backwards, given hi20's computation is based on lo12's immediate
being sign-extended, so feeding hi20 back into lo12's calculation is
somewhat circular) complexity has made its way into implementations in
toolchains and runtimes, which is bad.1 parent 4969a01 commit b43debd
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
472 | | - | |
| 471 | + | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
614 | | - | |
| 613 | + | |
| 614 | + | |
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
| |||
0 commit comments