rts/linker/ElfTypes.h: restore powerps (and others) support
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 14 May 2017 19:33:16 +0000 (20:33 +0100)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 14 May 2017 19:33:48 +0000 (20:33 +0100)
commitd5414dd61b540be3b3945c321065a1c70c7962ac
treea68172e5037cf810c3e1a196db8e36a43fc3aa7b
parent230416f8b6f6731064115a2905ad354e27b7d605
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
rts/linker/ElfTypes.h