Skip to content

Commit e7bd2a3

Browse files
committed
Define contrainsts for ULEB128
Binutils [1] and a currently in-flight LLD patch [2] define ULEB128 such that a SUB_ULEB128 must be preceded by a matching SET_ULEB128. This means that if the first SET_ULEB128 that comes before a given SUB_ULEB128 does not have the same relocation address, the linkers will fail. A SET_ULEB128 also cannot appear alone. Define this behavior in psABI such that libraries that read relocations are able to make this same assumption. This change enforces that SET_ULEB128 must always immediately preceed the associated SUB_ULEB128, and vice versa. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elfnn-riscv.c;h=09aa7be225ef3cba23fefd2ee977b3556a51368c;hb=HEAD#l2506 [2] https://reviews.llvm.org/D142880 Signed-off-by: Charlie Jenkins <[email protected]>
1 parent e5c800e commit e7bd2a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

riscv-elf.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,9 @@ Description:: Additional information about the relocation
456456
<| `ifunc_resolver(B + A)`
457457
.2+| 59 .2+| PLT32 .2+| Static | _word32_ .2+| 32-bit relative offset to a function or its PLT entry
458458
<| S + A - P
459-
.2+| 60 .2+| SET_ULEB128 .2+| Static | _ULEB128_ .2+| Local label assignment <<uleb128-note,*note>>
459+
.2+| 60 .2+| SET_ULEB128 .2+| Static | _ULEB128_ .2+| Must be placed immediately before a SUB_ULEB128 with the same offset. Local label assignment <<uleb128-note,*note>>
460460
<| S + A
461-
.2+| 61 .2+| SUB_ULEB128 .2+| Static | _ULEB128_ .2+| Local label subtraction <<uleb128-note,*note>>
461+
.2+| 61 .2+| SUB_ULEB128 .2+| Static | _ULEB128_ .2+| Must be placed immediately after a SET_ULEB128 with the same offset. Local label subtraction <<uleb128-note,*note>>
462462
<| V - S - A
463463
.2+| 62 .2+| TLSDESC_HI20 .2+| Static | _U-Type_ .2+| High 20 bits of a 32-bit PC-relative offset into a TLS descriptor entry, `%tlsdesc_hi(symbol)`
464464
<| S + A - P

0 commit comments

Comments
 (0)