Skip to content

Commit de76c95

Browse files
committed
Add note to R_RISCV_PCREL_LO12_[IS]
- GNU toolchain might use with addend, but it's deprecated.
1 parent 55d9ca9 commit de76c95

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

riscv-elf.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,8 @@ Enum | ELF Reloc Type | Description | Field | C
548548
21 | R_RISCV_TLS_GOT_HI20 | PC-relative TLS IE GOT offset | _U-Type_ | | Macro `la.tls.ie`
549549
22 | R_RISCV_TLS_GD_HI20 | PC-relative TLS GD reference | _U-Type_ | | Macro `la.tls.gd`
550550
23 | R_RISCV_PCREL_HI20 | PC-relative reference | _U-Type_ | S + A - P | `%pcrel_hi(symbol)`
551-
24 | R_RISCV_PCREL_LO12_I | PC-relative reference | _I-type_ | S - P | `%pcrel_lo(address of %pcrel_hi)`, the addend must be 0
552-
25 | R_RISCV_PCREL_LO12_S | PC-relative reference | _S-Type_ | S - P | `%pcrel_lo(address of %pcrel_hi)`, the addend must be 0
551+
24 | R_RISCV_PCREL_LO12_I | PC-relative reference | _I-type_ | S - P | `%pcrel_lo(address of %pcrel_hi)`, the addend must be 0 (*note 1)
552+
25 | R_RISCV_PCREL_LO12_S | PC-relative reference | _S-Type_ | S - P | `%pcrel_lo(address of %pcrel_hi)`, the addend must be 0 (*note 1)
553553
26 | R_RISCV_HI20 | Absolute address | _U-Type_ | S + A | `%hi(symbol)`
554554
27 | R_RISCV_LO12_I | Absolute address | _I-Type_ | S + A | `%lo(symbol)`
555555
28 | R_RISCV_LO12_S | Absolute address | _S-Type_ | S + A | `%lo(symbol)`
@@ -593,6 +593,13 @@ This section and later ones contain fragments written in assembler. The precise
593593
assembler syntax, including that of the relocations, is described in the
594594
[RISC-V Assembly Programmer's Manual](https://github.com/riscv/riscv-asm-manual).
595595

596+
```
597+
NOTE:
598+
599+
1: GNU Toolchain support `R_RISCV_PCREL_LO12_I` and `R_RISCV_PCREL_LO12_S`
600+
with non-zero addend, but it's deprecated, and will be obsoleted in future.
601+
```
602+
596603
### Calculation Symbols
597604

598605
The following table provides details on the variables used in relocation

0 commit comments

Comments
 (0)