Skip to content

Commit e6a905c

Browse files
committed
Deifne relocation for ULEB128 value
ULEB128 has used in DWARF and exception handling table, it used to record value, or record the distance between two symbols. The later one would be an issue for debug info and exception handling table, since the symbol address might updated during, then the value might incorrect after relaxation, some of those field has alternative encoding type, but some new field defined in DWARF 5 ins't provide alternative format other than ULEB128, e.g. DW_RLE_offset_pair, DW_RLE_startx_length, DW_RLE_startx_endx and DW_RLE_start_length. This PR basically same as #162, but updated to the trunk, and also document ULEB128 should not shrink the size of the data, since we never know the data used in where and does the length has recorded in somewhere or not, so this would be most safe way. binutils patch: https://sourceware.org/pipermail/binutils/2020-January/109672.html
1 parent 9a77e88 commit e6a905c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

riscv-elf.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,10 @@ Description:: Additional information about the relocation
445445
<| S + A - P
446446
.2+| 58 .2+| IRELATIVE .2+| Dynamic | _wordclass_ .2+| Relocation against a non-preemptible ifunc symbol
447447
<| `ifunc_resolver(B + A)`
448+
.2+| 59 .2+| SET_ULEB128 .2+| Static | _ULEB128_ .2+| Local label assignment
449+
<| S + A
450+
.2+| 60 .2+| SUB_ULEB128 .2+| Static | _ULEB128_ .2+| Local label subtraction
451+
<| V - S + A
448452
.2+| 59-191 .2+| *Reserved* .2+| - | .2+| Reserved for future standard use
449453
<|
450454
.2+| 192-255 .2+| *Reserved* .2+| - | .2+| Reserved for nonstandard ABI extensions
@@ -499,6 +503,7 @@ of the `__global_pointer$` symbol into register `gp` (aka `x3`).
499503
| _word16_ | Specifies a 16-bit word
500504
| _word32_ | Specifies a 32-bit word
501505
| _word64_ | Specifies a 64-bit word
506+
| _ULEB128_ | Specifies a variable-length data encoded in ULEB128 format.
502507
| _wordclass_ | Specifies a _word32_ field for ILP32 or a _word64_ field for LP64
503508
| _B-Type_ | Specifies a field as the immediate field in a B-type instruction
504509
| _CB-Type_ | Specifies a field as the immediate field in a CB-type instruction
@@ -1157,6 +1162,12 @@ are commonly resolved at compile-time, such as intra-function jumps), code
11571162
generators must in general ensure that relocations are always emitted when
11581163
relaxation is enabled.
11591164

1165+
Linker should adjust relocations which refer to those symbol has updated the
1166+
address.
1167+
1168+
ULEB128 value with relocation must be padding to the same length even if the
1169+
data can be encoded with a shorter byte sequence after linker relaxation.
1170+
11601171
=== Linker Relaxation Types
11611172

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

0 commit comments

Comments
 (0)