[GHC] #13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches)
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Builds fail as: {{{ rts_dist_HC rts/dist/build/RtsStartup.o rts/linker/ElfTypes.h:23:4: error: error: #error "Unsupported arch!" }}} The code that fails in '''rts/linker/ElfTypes.h''': {{{#!c # 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) # define ELF_64BIT #elif defined(sparc_HOST_ARCH) || defined(i386_HOST_ARCH) \ || defined(arm_HOST_ARCH) # define ELF_32BIT #else # error "Unsupported arch!" #endif }}} Note it's a whitelist of architectures. It fails at least on '''powerpc''' (arm_HOST_ARCH), '''hppa'' (hppa_HOST_ARCH), '''m68k''' (m68k_HOST_ARCH). '''mips''', '''mips64''', '''alpha''', '''s390x''', '''sparc64'''. It does not look like keeping a whitelist is scalable here. How about using {{{#!c #if defined(__LP64__) || defined (_LP64) }}} as a proxy for ELF64 and maintain a list of arches that are exception instead? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by slyfox: @@ -25,1 +25,1 @@ - '''powerpc''' (arm_HOST_ARCH), '''hppa'' (hppa_HOST_ARCH), '''m68k''' + '''powerpc''' (arm_HOST_ARCH), '''hppa''' (hppa_HOST_ARCH), '''m68k''' New description: Builds fail as: {{{ rts_dist_HC rts/dist/build/RtsStartup.o rts/linker/ElfTypes.h:23:4: error: error: #error "Unsupported arch!" }}} The code that fails in '''rts/linker/ElfTypes.h''': {{{#!c # 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) # define ELF_64BIT #elif defined(sparc_HOST_ARCH) || defined(i386_HOST_ARCH) \ || defined(arm_HOST_ARCH) # define ELF_32BIT #else # error "Unsupported arch!" #endif }}} Note it's a whitelist of architectures. It fails at least on '''powerpc''' (arm_HOST_ARCH), '''hppa''' (hppa_HOST_ARCH), '''m68k''' (m68k_HOST_ARCH). '''mips''', '''mips64''', '''alpha''', '''s390x''', '''sparc64'''. It does not look like keeping a whitelist is scalable here. How about using {{{#!c #if defined(__LP64__) || defined (_LP64) }}} as a proxy for ELF64 and maintain a list of arches that are exception instead? -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): Example output for toolchains I have (note mips64 is an ELFCLASS32 aka N32 ABI): {{{ for gcc in /usr/bin/*gcc /usr/bin/*clang; do echo "$gcc :"; $gcc -dM -E -x c /dev/null | egrep LP64; done }}} {{{ /usr/bin/aarch64-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/afl-gcc : afl-cc 2.39b by <lcamtuf@google.com> #define __LP64__ 1 #define _LP64 1 /usr/bin/alpha-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/armv5tel-softfloat-linux-gnueabi-gcc : /usr/bin/armv7a-hardfloat-linux-gnueabi-gcc : /usr/bin/armv7a-unknown-linux-gnueabi-gcc : /usr/bin/gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/hppa-unknown-linux-gnu-gcc : /usr/bin/i686-w64-mingw32-gcc : /usr/bin/ia64-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/m68k-unknown-linux-gnu-gcc : /usr/bin/mips64-unknown-linux-gnu-gcc : /usr/bin/powerpc-unknown-linux-gnu-gcc : /usr/bin/powerpc64-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/powerpc64le-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/s390x-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/sparc-unknown-linux-gnu-gcc : /usr/bin/sparc64-unknown-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/winegcc : /usr/bin/x86_64-pc-linux-gnu-gcc : #define __LP64__ 1 #define _LP64 1 /usr/bin/x86_64-w64-mingw32-gcc : /usr/bin/afl-clang : afl-cc 2.39b by <lcamtuf@google.com> #define _LP64 1 #define __LP64__ 1 /usr/bin/clang : #define _LP64 1 #define __LP64__ 1 /usr/bin/i686-pc-linux-gnu-clang : /usr/bin/x86_64-pc-linux-gnu-clang : #define _LP64 1 #define __LP64__ 1 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3583 Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * differential: => Phab:D3583 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3583 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Sergei Trofimovich <slyfox@…>): In [changeset:"d5414dd61b540be3b3945c321065a1c70c7962ac/ghc" d5414dd/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="d5414dd61b540be3b3945c321065a1c70c7962ac" 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 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13696: rts/linker/ElfTypes.h does not compile on most of UNREG arches (and some registerised arches) -------------------------------------+------------------------------------- Reporter: slyfox | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3583 Wiki Page: | -------------------------------------+------------------------------------- Changes (by slyfox): * status: new => closed * version: 8.0.1 => 8.3 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13696#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC