Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RELOCID for vendor-specific relocations #423

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions riscv-elf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -503,14 +503,22 @@ Description:: Additional information about the relocation
<| S - P
.2+| 65 .2+| TLSDESC_CALL .2+| Static | .2+| Annotate call to TLS descriptor resolver function, `%tlsdesc_call(address of %tlsdesc_hi)`, for relaxation purposes only
<|
.2+| 66-191 .2+| *Reserved* .2+| - | .2+| Reserved for future standard use
.2+| 66-190 .2+| *Reserved* .2+| - | .2+| Reserved for future standard use
<|
.2+| 191 .2+| VENDOR .2+| Static | .2+| Paired with a vendor-specific relocation and must be placed immediately before it, indicates which vendor owns the relocation.
<|
.2+| 192-255 .2+| *Reserved* .2+| - | .2+| Reserved for nonstandard ABI extensions
<|
|===

Nonstandard extensions are free to use relocation numbers 192-255 for any
purpose. These relocations may conflict with other nonstandard extensions.
purpose. These vendor-specific relocations must be preceded by a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You say must yet the next paragraph says where possible? It can’t be must, that’s not compatible with the historic definition.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed re compatibility with existing objects, this is an optional addition, we will fix that in the text.

The intent for the following paragraph was to talk about presentation in objdump, etc. where if it is possible to show for the custom reloc a name that takes into account the full pair of relocations it should (e.g. R_RISCV_MYVENDOR_MEANINGFUL_NAME, rather than say R_RISCV_CUSTOM192), rather than emphasising/making optional the existence of a differentiator reloc.

`R_RISCV_VENDOR` relocation against a vendor ID symbol.

Where possible, tools should present relocation as their vendor-specific
relocation types, otherwise a generic name of `R_RISCV_CUSTOM<enum value>` must
be shown. Data contained in paired `RISCV_VENDOR` can be used to select the
appropriate vendor when performing relocations.

This section and later ones contain fragments written in assembler. The precise
assembler syntax, including that of the relocations, is described in the
Expand All @@ -523,6 +531,16 @@ and fill the space with a single ULEB128-encoded value.
This is achieved by prepending the redundant `0x80` byte as necessary.
The linker must not alter the length of the ULEB128-encoded value.

==== Vendor identifiers

Vendor identifiers are dummy symbols used in the corresponding `R_RISCV_VENDOR`
relocation (irrespective of ELF class/XLEN) and must be unique amongst all
vendors providing custom relocations. Vendor identifiers may be suffixed with a
tag to provide extra relocations for a given vendor.

NOTE: Please refer to the _RISC-V Toolchain Conventions_
<<rv-toolchain-conventions>> for the full list.

==== Calculation Symbols

<<var-reloc-calc>> provides details on the variables used in relocation
Expand Down Expand Up @@ -2013,3 +2031,6 @@ https://github.com/riscv/riscv-code-size-reduction

* [[[rvv-intrinsic-doc]]] "RISC-V Vector Extension Intrinsic Document"
https://github.com/riscv-non-isa/rvv-intrinsic-doc

* [[[rv-toolchain-conventions]]] "RISC-V Toolchain Conventions"
https://github.com/riscv-non-isa/riscv-toolchain-conventions
Loading