diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2017-05-14 20:33:16 +0100 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2017-05-14 20:33:48 +0100 |
commit | d5414dd61b540be3b3945c321065a1c70c7962ac (patch) | |
tree | a68172e5037cf810c3e1a196db8e36a43fc3aa7b /rts | |
parent | 230416f8b6f6731064115a2905ad354e27b7d605 (diff) | |
download | haskell-d5414dd61b540be3b3945c321065a1c70c7962ac.tar.gz |
rts/linker/ElfTypes.h: restore powerps (and others) support
GHC build fails for powerpc-unknown-linux-gnu
and hppa-unknown-linux-gnu targets as:
rts_dist_HC rts/dist/build/RtsStartup.o
rts/linker/ElfTypes.h:23:4: error:
error: #error "Unsupported arch!"
Before the change code tried to whitelist architectures
and classify them into ELF32/ELF64. It does not work
for UNREG arches like 'hppa', 'sparc64', 'm68k', 'mips'.
It is nuanced for things like mips64 and x86_64:
'mips64-unknown-linux-gnu-gcc -mabi=64' is ELFCLASS64
'mips64-unknown-linux-gnu-gcc' is ELFCLASS32
'x86_64-pc-linux-gnu-gcc' is ELFCLASS64
'x86_64-pc-linux-gnu-gcc -mx32' is ELFCLASS32
Here it's not enough to know HOST_ARCH. We really need to
know ABI.
The change uses '__LP64__' as a proxy for ELFCLASS64.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewers: angerman, simonmar, austin, bgamari, erikd
Reviewed By: angerman, bgamari, erikd
Subscribers: rwbarton, thomie
GHC Trac Issues: #13696
Differential Revision: https://phabricator.haskell.org/D3583
Diffstat (limited to 'rts')
-rw-r--r-- | rts/linker/ElfTypes.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/rts/linker/ElfTypes.h b/rts/linker/ElfTypes.h index 2f34d4addc..ca5bc58038 100644 --- a/rts/linker/ElfTypes.h +++ b/rts/linker/ElfTypes.h @@ -12,15 +12,12 @@ */ # define ELF_TARGET_AMD64 /* Used inside <elf.h> on Solaris 11 */ -#if defined(powerpc64_HOST_ARCH) || defined(powerpc64le_HOST_ARCH) \ - || defined(ia64_HOST_ARCH) || defined(aarch64_HOST_ARCH) \ - || defined(x86_64_HOST_ARCH) + +/* __LP64__ is a rough proxy if a platform is ELFCLASS64 */ +#if defined(__LP64__) || defined(_LP64) # define ELF_64BIT -#elif defined(sparc_HOST_ARCH) || defined(i386_HOST_ARCH) \ - || defined(arm_HOST_ARCH) -# define ELF_32BIT #else -# error "Unsupported arch!" +# define ELF_32BIT #endif #if defined(ELF_64BIT) |