aboutsummaryrefslogtreecommitdiff
path: root/exec/hostarch.c
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-05-15 10:35:57 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-05-15 18:32:03 +0200
commit0e6a671b828b28b186822f0a2125272781b84c28 (patch)
treeb809de40685ef2ce4d14ca4047fb939efb2d9e93 /exec/hostarch.c
parentc1d219c066a5fbf6a6a4c3139f64954dbf12fd02 (diff)
downloadhurd-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/hostarch.c')
-rw-r--r--exec/hostarch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/exec/hostarch.c b/exec/hostarch.c
index 363fda69..ed50e0a8 100644
--- a/exec/hostarch.c
+++ b/exec/hostarch.c
@@ -72,6 +72,15 @@ elf_machine_matches_host (ElfW(Half) e_machine)
case CPU_TYPE_PENTIUMPRO:
CACHE (e_machine == EM_386);
+ /* When building for x86_64, CPU_TYPE_X86_64 must be defined; otherwise
+ it's OK if we don't compile this branch -- none of the branches other
+ than the actual architecture the code is built for are going to be
+ taken anyway. */
+#if defined (CPU_TYPE_X86_64) || defined (__x86_64__)
+ case CPU_TYPE_X86_64:
+ CACHE (e_machine == EM_X86_64);
+#endif
+
case CPU_TYPE_POWERPC:
CACHE (e_machine == EM_PPC);