Skip to contentSkip to conversation

elf: add Elf64_Sym

PATCH In review KaDiWa 3 participants 3 messages Jan 23, 2023 – Feb 7, 2023

lore
Share & tools
lore

KaDiWa

author
#0 lore raw

PATCH 1/1 elf: add Elf64_Sym

Required as Elf_Sym in tools/prelink-riscv.inc. I assume people have been using an OS-supplied elf.h, but macOS doesn't have that.

Taken from
https://github.com/torvalds/linux/blob/v6.1/include/uapi/linux/elf.h

---
 include/elf.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/elf.h +9 -0
index aeda159f0c..a4ba74d8ab 100644
@@ -360,6 +360,15 @@ typedef struct {
 	Elf32_Half	st_shndx;	/* section header index */
 } Elf32_Sym;
 
+typedef struct {
+	Elf64_Word	st_name;	/* name - index into string table */
+	unsigned char	st_info;	/* type and binding */
+	unsigned char	st_other;	/* 0 - no defined meaning */
+	Elf64_Half	st_shndx;	/* section header index */
+	Elf64_Addr	st_value;	/* symbol value */
+	Elf64_Xword	st_size;	/* symbol size */
+} Elf64_Sym;
+
 /* Symbol table index */
 #define STN_UNDEF	0		/* undefined */
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · KaDiWa

Required as Elf_Sym in tools/prelink-riscv.inc. I assume people have been using an OS-supplied elf.h, but macOS doesn't have that.

Taken from
https://github.com/torvalds/linux/blob/v6.1/include/uapi/linux/elf.h

---
 include/elf.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/elf.h +9 -1
index aeda159f0c..a4ba74d8ab 100644
@@ -360,6 +360,15 @@ typedef struct {
        Elf32_Half      st_shndx;       /* section header index */
 } Elf32_Sym;
 
+typedef struct {
+       Elf64_Word      st_name;        /* name - index into string table */
+       unsigned char   st_info;        /* type and binding */
+       unsigned char   st_other;       /* 0 - no defined meaning */
+       Elf64_Half      st_shndx;       /* section header index */
+       Elf64_Addr      st_value;       /* symbol value */
+       Elf64_Xword     st_size;        /* symbol size */
+} Elf64_Sym;
+
 /* Symbol table index */
 #define STN_UNDEF      0               /* undefined */
 
--
Quoted 2 lines

2.37.1 (Apple Git-137.1)