diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-15 10:35:57 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-15 18:32:03 +0200 |
commit | 0e6a671b828b28b186822f0a2125272781b84c28 (patch) | |
tree | b809de40685ef2ce4d14ca4047fb939efb2d9e93 /exec/exec.c | |
parent | c1d219c066a5fbf6a6a4c3139f64954dbf12fd02 (diff) | |
download | hurd-0e6a671b828b28b186822f0a2125272781b84c28.tar.gz hurd-0e6a671b828b28b186822f0a2125272781b84c28.tar.bz2 hurd-0e6a671b828b28b186822f0a2125272781b84c28.zip |
exec: Allow loading x86_64 executables on x86_64
Since we don't support mixing i386 and x86_64 binaries on the same
system (as running them requires different build-time gnumach
configurations), the exec server can simply require the binary being
loaded to have been built for the same architecture as the exec server
itself.
Message-Id: <20230515073600.1350072-1-bugaevc@gmail.com>
Diffstat (limited to 'exec/exec.c')
-rw-r--r-- | exec/exec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/exec/exec.c b/exec/exec.c index 8944167d..2e5fbfcd 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -518,6 +518,12 @@ prepare (file_t file, struct execdata *e) #define host_ELFDATA ELFDATA2LSB #endif +#ifdef __LP64__ +#define host_ELFCLASS ELFCLASS64 +#else +#define host_ELFCLASS ELFCLASS32 +#endif + static void check_elf (struct execdata *e) { @@ -539,7 +545,7 @@ check_elf (struct execdata *e) return; } - if (ehdr->e_ident[EI_CLASS] != ELFCLASS32 || + if (ehdr->e_ident[EI_CLASS] != host_ELFCLASS || ehdr->e_ident[EI_DATA] != host_ELFDATA || ehdr->e_ident[EI_VERSION] != EV_CURRENT || ehdr->e_version != EV_CURRENT || |