Skip to content

Commit 4b4fb6a

Browse files
authored
Merge pull request #361 from riscv-non-isa/uleb128-reloc
Define relocations for ULEB128 value: R_RISCV_SET_ULEB128 and R_RISCV_SUB_ULEB128
2 parents 6cda892 + 96d6e19 commit 4b4fb6a

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

riscv-elf.adoc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,11 @@ Description:: Additional information about the relocation
447447
<| `ifunc_resolver(B + A)`
448448
.2+| 59 .2+| PLT32 .2+| Static | _word32_ .2+| 32-bit relative offset to a function or its PLT entry
449449
<| S + A - P
450-
.2+| 60-191 .2+| *Reserved* .2+| - | .2+| Reserved for future standard use
450+
.2+| 60 .2+| SET_ULEB128 .2+| Static | _ULEB128_ .2+| Local label assignment <<uleb128-note,*note>>
451+
<| S + A
452+
.2+| 61 .2+| SUB_ULEB128 .2+| Static | _ULEB128_ .2+| Local label subtraction <<uleb128-note,*note>>
453+
<| V - S + A
454+
.2+| 62-191 .2+| *Reserved* .2+| - | .2+| Reserved for future standard use
451455
<|
452456
.2+| 192-255 .2+| *Reserved* .2+| - | .2+| Reserved for nonstandard ABI extensions
453457
<|
@@ -460,6 +464,12 @@ This section and later ones contain fragments written in assembler. The precise
460464
assembler syntax, including that of the relocations, is described in the
461465
_RISC-V Assembly Programmer's Manual_ <<rv-asm>>.
462466

467+
[[uleb128-note]]
468+
NOTE: The assembler must allocate enough space to accommodate ULEB128 data for
469+
`R_RISCV_SET_ULEB128` and `R_RISCV_SUB_ULEB128` relocations. This can be
470+
achieved either by padding with zeroes to fill up to the XLEN-bits boundary
471+
or by filling the precomputed result into the relocation location.
472+
463473
==== Calculation Symbols
464474

465475
<<var-reloc-calc>> provides details on the variables used in relocation
@@ -501,6 +511,7 @@ of the `__global_pointer$` symbol into register `gp` (aka `x3`).
501511
| _word16_ | Specifies a 16-bit word
502512
| _word32_ | Specifies a 32-bit word
503513
| _word64_ | Specifies a 64-bit word
514+
| _ULEB128_ | Specifies a variable-length data encoded in ULEB128 format.
504515
| _wordclass_ | Specifies a _word32_ field for ILP32 or a _word64_ field for LP64
505516
| _B-Type_ | Specifies a field as the immediate field in a B-type instruction
506517
| _CB-Type_ | Specifies a field as the immediate field in a CB-type instruction
@@ -1221,6 +1232,14 @@ are commonly resolved at compile-time, such as intra-function jumps), code
12211232
generators must in general ensure that relocations are always emitted when
12221233
relaxation is enabled.
12231234

1235+
Linkers should adjust relocations that refer to symbols whose addresses have
1236+
been updated.
1237+
1238+
ULEB128 value with relocation must be padding to the same length even if the
1239+
data can be encoded with a shorter byte sequence after linker relaxation, The
1240+
linker should report errors if the length of ULEB128 byte sequence is more
1241+
extended than the current byte sequence.
1242+
12241243
=== Linker Relaxation Types
12251244

12261245
The purpose of this section is to describe all types of linker relaxation,

0 commit comments

Comments
 (0)