Skip to content

Commit 2acb329

Browse files
committed
Rework Nonstandard Relocations
The primary change here is to require that vendor identifier symbols are Defined, STB_LOCAL, STT_NOTYPE, and zero-sized. This also slightly reorganises what was the "Vendor Identifiers" section to bring together all the paragraphs about the nonstandard relocations, so they are in one place. This rewording is not intended to change the meaning of what was written before.
1 parent eb2b296 commit 2acb329

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

riscv-elf.adoc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,6 @@ Description:: Additional information about the relocation
556556
<|
557557
|===
558558

559-
Nonstandard extensions are free to use relocation numbers 192-255 for any
560-
purpose. These vendor-specific relocations must be preceded by a
561-
`R_RISCV_VENDOR` relocation against a vendor ID symbol.
562-
563-
Where possible, tools should present relocation as their vendor-specific
564-
relocation types, otherwise a generic name of `R_RISCV_CUSTOM<enum value>` must
565-
be shown. Data contained in paired `RISCV_VENDOR` can be used to select the
566-
appropriate vendor when performing relocations.
567-
568559
This section and later ones contain fragments written in assembler. The precise
569560
assembler syntax, including that of the relocations, is described in the
570561
_RISC-V Assembly Programmer's Manual_ <<rv-asm>>.
@@ -576,15 +567,27 @@ and fill the space with a single ULEB128-encoded value.
576567
This is achieved by prepending the redundant `0x80` byte as necessary.
577568
The linker must not alter the length of the ULEB128-encoded value.
578569

579-
==== Vendor identifiers
570+
==== Nonstandard Relocations (a.k.a. Vendor-Specific Relocations)
580571

581-
Vendor identifiers are dummy symbols used in the corresponding `R_RISCV_VENDOR`
582-
relocation (irrespective of ELF class/XLEN) and must be unique amongst all
583-
vendors providing custom relocations. Vendor identifiers may be suffixed with a
584-
tag to provide extra relocations for a given vendor.
572+
Nonstandard extensions are free to use relocation numbers 192-255 for any
573+
purpose. These vendor-specific relocations must be preceded by a
574+
`R_RISCV_VENDOR` relocation against a vendor identifier symbol. The preceding
575+
`R_RISCV_VENDOR` relocation is used by the linker to choose the correct
576+
implementation for the associated nonstandard relocation.
577+
578+
The vendor identifier symbol should be a defined symbol and should set the type
579+
to `STT_NOTYPE`, binding to `STB_LOCAL`, and the size of symbol to zero.
580+
581+
Vendor identifiers must be unique amongst all vendors providing custom
582+
relocations. Vendor identifiers may be suffixed with a tag to provide extra
583+
relocations for a given vendor.
585584

586585
NOTE: Please refer to the _RISC-V Toolchain Conventions_
587-
<<rv-toolchain-conventions>> for the full list.
586+
<<rv-toolchain-conventions>> for the full list of vendor identifiers.
587+
588+
Where possible, tools should present relocation as their vendor-specific
589+
relocation types, otherwise a generic name of `R_RISCV_CUSTOM<enum value>` must
590+
be shown.
588591

589592
==== Calculation Symbols
590593

0 commit comments

Comments
 (0)