aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-12 12:56:04 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-08-12 13:01:19 +0200
commit8038791ac9a43ffdc0083455bf01ac6b719e0bcf (patch)
tree262eb791bfe0f17a396e130c519af3ee47d96178 /include
parent811c81eef4f168cdbc960c381711a4bff69305f0 (diff)
downloadgnumach-8038791ac9a43ffdc0083455bf01ac6b719e0bcf.tar.gz
gnumach-8038791ac9a43ffdc0083455bf01ac6b719e0bcf.tar.bz2
gnumach-8038791ac9a43ffdc0083455bf01ac6b719e0bcf.zip
x86_64: Fix loading ELF symbols
Diffstat (limited to 'include')
-rw-r--r--include/mach/exec/elf.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/include/mach/exec/elf.h b/include/mach/exec/elf.h
index f52e115d..409947c4 100644
--- a/include/mach/exec/elf.h
+++ b/include/mach/exec/elf.h
@@ -152,6 +152,19 @@ typedef struct {
Elf32_Word sh_entsize;
} Elf32_Shdr;
+typedef struct elf64_shdr {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+} Elf64_Shdr;
+
/* section types - page 4-15, figure 4-9 */
#define SHT_NULL 0
@@ -190,11 +203,28 @@ typedef struct
Elf32_Half st_shndx;
} Elf32_Sym;
+typedef struct elf64_sym {
+ Elf64_Word st_name;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf64_Half st_shndx;
+ Elf64_Addr st_value;
+ Elf64_Xword st_size;
+} Elf64_Sym;
+
+#ifdef __x86_64__
+#define Elf_Sym Elf64_Sym
+#define Elf_Shdr Elf64_Shdr
+#else
+#define Elf_Sym Elf32_Sym
+#define Elf_Shdr Elf32_Shdr
+#endif
+
/* symbol type and binding attributes - page 4-26 */
-#define ELF32_ST_BIND(i) ((i) >> 4)
-#define ELF32_ST_TYPE(i) ((i) & 0xf)
-#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
+#define ELF_ST_BIND(i) ((i) >> 4)
+#define ELF_ST_TYPE(i) ((i) & 0xf)
+#define ELF_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
/* symbol binding - page 4-26, figure 4-16 */