Skip to contentSkip to conversation

elf: Add RISC-V PSABI ELF header defines

PATCH In review Michael Clark 2 participants 3 messages May 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 elf: Add RISC-V PSABI ELF header defines

Refer to the RISC-V PSABI specification for details:

- https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

Cc Michael Tokarev <[email protected]>
Cc Laurent Vivier <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Alistair Francis <[email protected]>
---
 include/elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/elf.h +8 -0
index 934dbbd6b3ae..bd0493f43d19 100644
@@ -1285,6 +1285,14 @@ typedef struct {
 #define R_IA64_DTPREL64LSB	0xb7	/* @dtprel(sym + add), data8 LSB */
 #define R_IA64_LTOFF_DTPREL22	0xba	/* @ltoff(@dtprel(s+a)), imm22 */
 
+/* RISC-V specific definitions.  */
+#define EF_RISCV_RVC 0x0001
+#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
+
 typedef struct elf32_rel {
   Elf32_Addr	r_offset;
   Elf32_Word	r_info;
Signature · 1 line
2.7.0
Reviewed-by on v2 1/1
#1 lore raw

Le 25/05/2018 à 09:22, Michael Clark a écrit :

Quoted 23 lines

Refer to the RISC-V PSABI specification for details:

- https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

Cc Michael Tokarev <[email protected]>
Cc Laurent Vivier <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Alistair Francis <[email protected]>
---
 include/elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/elf.h +1 -0
index 934dbbd6b3ae..bd0493f43d19 100644
@@ -1285,6 +1285,14 @@ typedef struct {
 #define R_IA64_DTPREL64LSB	0xb7	/* @dtprel(sym + add), data8 LSB */
 #define R_IA64_LTOFF_DTPREL22	0xba	/* @ltoff(@dtprel(s+a)), imm22 */
 
+/* RISC-V specific definitions.  */

include/elf.h typedef struct { · line 1298

Quoted 10 lines
include/elf.h +7 -0
+#define EF_RISCV_RVC 0x0001
+#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
+
 typedef struct elf32_rel {
   Elf32_Addr	r_offset;
   Elf32_Word	r_info;

from glibc (and binutils), I have:

  /* RISC-V ELF Flags */
  #define EF_RISCV_RVC                    0x0001
  #define EF_RISCV_FLOAT_ABI              0x0006
  #define EF_RISCV_FLOAT_ABI_SOFT         0x0000
  #define EF_RISCV_FLOAT_ABI_SINGLE       0x0002
  #define EF_RISCV_FLOAT_ABI_DOUBLE       0x0004
  #define EF_RISCV_FLOAT_ABI_QUAD         0x0006

Perhaps you can also define EF_RISCV_FLOAT_ABI_SOFT and EF_RISCV_FLOAT_ABI?

Anyway:

#2 lore raw
Quoted 46 lines · Laurent Vivier
Quoted 18 lines · Michael Clark

Refer to the RISC-V PSABI specification for details:

- https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md

Cc Michael Tokarev <[email protected]>
Cc Laurent Vivier <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Alistair Francis <[email protected]>
---
 include/elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/elf.h +0 -0
index 934dbbd6b3ae..bd0493f43d19 100644

include/elf.h typedef struct { · line 1286

Quoted 2 lines
include/elf.h +0 -0
@@ -1285,6 +1285,14 @@ typedef struct {
 #define R_IA64_DTPREL64LSB   0xb7    /* @dtprel(sym + add), data8 LSB */
 #define R_IA64_LTOFF_DTPREL22        0xba    /* @ltoff(@dtprel(s+a)),

imm22 */

include/elf.h typedef struct {

Quoted 13 lines
include/elf.h +8 -0
+/* RISC-V specific definitions.  */
+#define EF_RISCV_RVC 0x0001
+#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
+
 typedef struct elf32_rel {
   Elf32_Addr r_offset;
   Elf32_Word r_info;
 

from glibc (and binutils), I have:

  /* RISC-V ELF Flags */
  #define EF_RISCV_RVC                    0x0001
  #define EF_RISCV_FLOAT_ABI              0x0006
  #define EF_RISCV_FLOAT_ABI_SOFT         0x0000
  #define EF_RISCV_FLOAT_ABI_SINGLE       0x0002
  #define EF_RISCV_FLOAT_ABI_DOUBLE       0x0004
  #define EF_RISCV_FLOAT_ABI_QUAD         0x0006
Quoted 2 lines

Perhaps you can also define EF_RISCV_FLOAT_ABI_SOFT and EF_RISCV_FLOAT_ABI?

Will do. I'll align them also.

Anyway:

Quoted 4 lines

Thanks for checking glibc and binutils. I'll update to add the extra definitions before I make a PR. Thanks!

Michael.