Skip to content

Commit 7ad4184

Browse files
committed
Reserve e_flags bits 24 through 31 for custom use
Whilst here, correctly pluralise some headers and use consistent alignment. Closes: #157
1 parent 6ecd27f commit 7ad4184

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

riscv-elf.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ rules about 2×XLEN aligned arguments being passed in "aligned" register pa
469469
* e_flags: Describes the format of this ELF file. These flags are used by the
470470
linker to disallow linking ELF files with incompatible ABIs together.
471471

472-
Bit 0 | Bit 1 - 2 | Bit 3 | Bit 4 | Bit 5 - 31
473-
-------|------------|-------|-------|------------
474-
RVC | Float ABI | RVE | TSO | *Reserved*
472+
Bit 0 | Bits 1 - 2 | Bit 3 | Bit 4 | Bits 5 - 23 | Bits 24 - 31
473+
-------|------------|-------|-------|-------------|---------------------------
474+
RVC | Float ABI | RVE | TSO | *Reserved* | *Non-standard extensions*
475475

476476
* EF_RISCV_RVC (0x0001): This bit is set when the binary targets the C ABI,
477477
which allows instructions to be aligned to 16-bit boundaries (the base RV32
@@ -497,9 +497,18 @@ rules about 2×XLEN aligned arguments being passed in "aligned" register pa
497497
* EF_RISCV_TSO (0x0010): This bit is set when the binary requires the RVTSO
498498
memory consistency model.
499499

500-
Until such a time that the *Reserved* bits (0xffffffe0) are allocated by
500+
Until such a time that the *Reserved* bits (0x00ffffe0) are allocated by
501501
future versions of this specification, they shall not be set by standard
502-
software.
502+
software. Non-standard extensions are free to use bits 24-31 for any purpose.
503+
This many conflict with other non-standard extensions.
504+
505+
> NOTE:
506+
> There is no provision for compatibility between conflicting uses of the
507+
> e_flags bits reserved for non-standard extensions, and many standard RISC-V
508+
> tools will ignore them. Do not use them unless you control both the
509+
> toolchain and the operating system, and the ABI differences are so
510+
> significant they cannot be done with a .RISCV.attributes tag nor an ELF
511+
> note, such as using a different syscall ABI.
503512
504513
## <a name=sections></a>Sections
505514

0 commit comments

Comments
 (0)