Skip to content

Draft: ghc 8.10: mac os arm64

Moritz Angermann requested to merge wip/angerman/ghc-8.10.3-macOS-arm64 into ghc-8.10

AArch64 support for Darwin

This is a rather large MR, which is mostly benign though. It adds two different parts:

AArch64 Darwin changes

To support AArch64 on Darwin, we need a few small changes to adjust the build system, these are usually just minor checks, the largest being the InfoTables.hsc, which splits making executable space into two phases: allocating writable memory and then marking it executable.

The larger change is that we need to support the C calling convention on darwin. GHC did cut corners a long time ago assuming calling conventions would align with the default linux one in all eternity. On darwin however we need to pack arguments by size on the stack if they are spilled, and need to take care of extending results as well.

The idea in 9.2 is to introduce properly sized primitives in cmm, for 8.10 and 9.0 we'll have to use a band aid. This band aid is sticking the signature of the c function call, at the desugar phase into the ForeignConvention from where we can retrieve it in the codegen, and then produce the correct calling convention.

CI Support for aarch64-darwin

To make sense of all this, we add CI support for aarch64-darwin as well, this re-uses a lot of the logic we had for x86_64-darwin, and makes it a bit more principled by running all ci.sh commands through a properly provisioned pure shell.nix.}

Resolutions

I believe this fixes at least #8127 (closed), #13624 on darwin.

Parts

This was now split into multiple MRs:

!4991 (closed), !4992 (merged), !4993 (closed), !4994 (closed), !4995 (merged), !4996 (closed), !4997 (closed), !4998 (closed), !4999 (closed), !5000 (closed), !5001 (closed), !5002 (closed), !5004 (merged), !5008 (closed)

Edited by Moritz Angermann

Merge request reports