[commit: ghc] master: rts/linker/ElfTypes.h: restore powerps (and others) support (d5414dd)
git at git.haskell.org
git at git.haskell.org
Sun May 14 19:34:48 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d5414dd61b540be3b3945c321065a1c70c7962ac/ghc
>---------------------------------------------------------------
commit d5414dd61b540be3b3945c321065a1c70c7962ac
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date: Sun May 14 20:33:16 2017 +0100
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 at 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
>---------------------------------------------------------------
d5414dd61b540be3b3945c321065a1c70c7962ac
rts/linker/ElfTypes.h | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/rts/linker/ElfTypes.h b/rts/linker/ElfTypes.h
index 2f34d4a..ca5bc58 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)
More information about the ghc-commits
mailing list