* [PATCH] Update RISC-V specific ELF definitions
@ 2022-05-03 15:14 Andreas Schwab
2022-05-12 20:41 ` Fangrui Song
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2022-05-03 15:14 UTC (permalink / raw)
To: libc-alpha
The definitions are taken from the 1.0-rc2 version of the ELF psABI.
---
elf/elf.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/elf/elf.h b/elf/elf.h
index 0195029188..648bf66c7d 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -3927,6 +3927,8 @@ enum
#define EF_RISCV_FLOAT_ABI_SINGLE 0x0002
#define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004
#define EF_RISCV_FLOAT_ABI_QUAD 0x0006
+#define EF_RISCV_RVE 0x0008
+#define EF_RISCV_TSO 0x0010
/* RISC-V relocations. */
#define R_RISCV_NONE 0
@@ -3987,6 +3989,18 @@ enum
#define R_RISCV_NUM 59
+/* RISC-V specific values for the st_other field. */
+#define STO_RISCV_VARIANT_CC 0x80
+
+/* RISC-V specific values for the sh_type field. */
+#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
+
+/* RISC-V specific values for the p_type field. */
+#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
+
+/* RISC-V specific values for the d_tag field. */
+#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
+
/* BPF specific declarations. */
#define R_BPF_NONE 0 /* No reloc */
--
2.35.2
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Update RISC-V specific ELF definitions
2022-05-03 15:14 [PATCH] Update RISC-V specific ELF definitions Andreas Schwab
@ 2022-05-12 20:41 ` Fangrui Song
0 siblings, 0 replies; 2+ messages in thread
From: Fangrui Song @ 2022-05-12 20:41 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-alpha
On 2022-05-03, Andreas Schwab wrote:
>The definitions are taken from the 1.0-rc2 version of the ELF psABI.
>---
> elf/elf.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
>diff --git a/elf/elf.h b/elf/elf.h
>index 0195029188..648bf66c7d 100644
>--- a/elf/elf.h
>+++ b/elf/elf.h
>@@ -3927,6 +3927,8 @@ enum
> #define EF_RISCV_FLOAT_ABI_SINGLE 0x0002
> #define EF_RISCV_FLOAT_ABI_DOUBLE 0x0004
> #define EF_RISCV_FLOAT_ABI_QUAD 0x0006
>+#define EF_RISCV_RVE 0x0008
>+#define EF_RISCV_TSO 0x0010
>
> /* RISC-V relocations. */
> #define R_RISCV_NONE 0
>@@ -3987,6 +3989,18 @@ enum
>
> #define R_RISCV_NUM 59
>
>+/* RISC-V specific values for the st_other field. */
>+#define STO_RISCV_VARIANT_CC 0x80
I see that there is a precedent that STO_AARCH64_VARIANT_PCS calls this
"AArch64 specific values for the st_other field", but a descriptive
comment may be more useful, e.g. "Mark functions that do not follow the
standard calling convention for the ABI in use."
"RISC-V specific" can probably be removed as "RISCV" in the macro name
self explains.
>+/* RISC-V specific values for the sh_type field. */
>+#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
>+
>+/* RISC-V specific values for the p_type field. */
>+#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
>+
>+/* RISC-V specific values for the d_tag field. */
>+#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
>+
> /* BPF specific declarations. */
>
> #define R_BPF_NONE 0 /* No reloc */
>--
>2.35.2
I have verified these values match
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/download/v1.0-rc2/riscv-abi.pdf
Reviewed-by: Fangrui Song <maskray@google.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-12 20:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 15:14 [PATCH] Update RISC-V specific ELF definitions Andreas Schwab
2022-05-12 20:41 ` Fangrui Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).