aboutsummaryrefslogtreecommitdiff
path: root/kern/elf-load.c
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2023-02-16 22:33:16 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-02-16 23:27:25 +0100
commit78395241a0546832f0904492579df8210f7a176e (patch)
tree1f6d8454b4e347b9bf3d3b2b694a1d1526fa9413 /kern/elf-load.c
parentbdfedb6e4ada9adc78137d75065b9e9607223f4f (diff)
downloadgnumach-78395241a0546832f0904492579df8210f7a176e.tar.gz
gnumach-78395241a0546832f0904492579df8210f7a176e.tar.bz2
gnumach-78395241a0546832f0904492579df8210f7a176e.zip
x86_64: load Elf64 bootstrap modules if ! USER32
* i386/include/mach/i386/exec/elf.h: add Elf64 definitions and define common Elf structures, corresponding to 32/64 bit variants at compile time. * include/mach/exec/elf.h: add Elf64 definitions * kern/elf-load.c: use common Elf structures Message-Id: <20230216213318.2048699-2-luca@orpolo.org>
Diffstat (limited to 'kern/elf-load.c')
-rw-r--r--kern/elf-load.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/elf-load.c b/kern/elf-load.c
index 3e80edfe..ce86327c 100644
--- a/kern/elf-load.c
+++ b/kern/elf-load.c
@@ -31,8 +31,8 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec,
void *handle, exec_info_t *out_info)
{
vm_size_t actual;
- Elf32_Ehdr x;
- Elf32_Phdr *phdr, *ph;
+ Elf_Ehdr x;
+ Elf_Phdr *phdr, *ph;
vm_size_t phsize;
int i;
int result;
@@ -51,7 +51,7 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec,
return EX_NOT_EXECUTABLE;
/* Make sure the file is of the right architecture. */
- if ((x.e_ident[EI_CLASS] != ELFCLASS32) ||
+ if ((x.e_ident[EI_CLASS] != MY_ELF_CLASS) ||
(x.e_ident[EI_DATA] != MY_EI_DATA) ||
(x.e_machine != MY_E_MACHINE))
return EX_WRONG_ARCH;
@@ -65,7 +65,7 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec,
out_info->entry = (vm_offset_t) x.e_entry + loadbase;
phsize = x.e_phnum * x.e_phentsize;
- phdr = (Elf32_Phdr *)alloca(phsize);
+ phdr = (Elf_Phdr *)alloca(phsize);
result = (*read)(handle, x.e_phoff, phdr, phsize, &actual);
if (result)
@@ -75,7 +75,7 @@ int exec_load(exec_read_func_t *read, exec_read_exec_func_t *read_exec,
for (i = 0; i < x.e_phnum; i++)
{
- ph = (Elf32_Phdr *)((vm_offset_t)phdr + i * x.e_phentsize);
+ ph = (Elf_Phdr *)((vm_offset_t)phdr + i * x.e_phentsize);
if (ph->p_type == PT_LOAD)
{
exec_sectype_t type = EXEC_SECTYPE_ALLOC |