
Andreas Klebinger pushed to branch wip/andreask/linker_fix at Glasgow Haskell Compiler / GHC Commits: 81577fe7 by Ben Gamari at 2025-08-02T04:29:39-04:00 configure: Allow override of CrossCompiling As noted in #26236, the current inference logic is a bit simplistic. In particular, there are many cases (e.g. building for a new libc) where the target and host triples may differ yet we are still able to run the produced artifacts as native code. Closes #26236. - - - - - 01136779 by Andreas Klebinger at 2025-08-02T04:30:20-04:00 rts: Support COFF BigObj files in archives. - - - - - 22c4929c by Andreas Klebinger at 2025-08-04T09:26:14+02:00 rts: Support AArch64/X86(32bit) coff files in loader. - - - - - 2 changed files: - configure.ac - rts/linker/LoadArchive.c Changes: ===================================== configure.ac ===================================== @@ -351,15 +351,23 @@ fi dnl ** Building a cross compiler? dnl -------------------------------------------------------------- -CrossCompiling=NO -# If 'host' and 'target' differ, then this means we are building a cross-compiler. -if test "$target" != "$host" ; then - CrossCompiling=YES - cross_compiling=yes # This tells configure that it can accept just 'target', - # otherwise you get - # configure: error: cannot run C compiled programs. - # If you meant to cross compile, use `--host'. +dnl We allow the user to override this since the target/host check +dnl can get this wrong in some particular cases. See #26236. +if test -z "$CrossCompiling" ; then + CrossCompiling=NO + # If 'host' and 'target' differ, then this means we are building a cross-compiler. + if test "$target" != "$host" ; then + CrossCompiling=YES + fi +fi +if test "$CrossCompiling" = "YES"; then + # This tells configure that it can accept just 'target', + # otherwise you get + # configure: error: cannot run C compiled programs. + # If you meant to cross compile, use `--host'. + cross_compiling=yes fi + if test "$BuildPlatform" != "$HostPlatform" ; then AC_MSG_ERROR([ You've selected: ===================================== rts/linker/LoadArchive.c ===================================== @@ -140,6 +140,16 @@ static enum ObjectFileFormat identifyObjectFile_(char* buf, size_t sz) if (sz > 4 && ((uint32_t*)buf)[0] == 0xfeedfacf) { return MachO64; } + // BigObj COFF files ... + if (sz > 8 && ((uint64_t*)buf)[0] == 0x86640002ffff0000) { + return COFFAmd64; + } + if (sz > 8 && ((uint64_t*)buf)[0] == 0x014c0002ffff0000) { + return COFFI386; + } + if (sz > 8 && ((uint64_t*)buf)[0] == 0xaa640002ffff0000) { + return COFFAArch64; + } return NotObject; } View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e4e328ac6a51809950d7f895da14c6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8e4e328ac6a51809950d7f895da14c6... You're receiving this email because of your account on gitlab.haskell.org.