Skip to content

GHC should pass --target to CC when available

Currently GHC assumes that multi-platform toolchain support is implemented via target-prefixed toolchain binaries (e.g. x86_64-unknown-linux-cc). However, modern Darwin distributions rather ship with a single clang binary which is runtime-retargetable via the --target=<triple> flag. In cases where no --target flag is provided the toolchain compiles for the native platform of the slice which was executed. Unfortunately, it is hard to predict which slice will be executed as it appears to depend upon whether any process in the parent hierarchy is executed via Rosetta. This means that using an x86-64 cabal install to invoke an AArch64 ghc will result in assembler errors as CC tries to compile the AArch64 assembly produced by GHC as x86-64 syntax.

To avoid this we should test whether the toolchain supports --target and pass it when necessary.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information