Dead code elimination is broken on AArch64/Darwin
GHC supports dead-code elimination on Darwin by way of a mechanism known as "subsections via symbols". However, it turns out that this support is explicitly disabled in our configure
script (see https://gitlab.haskell.org/ghc/ghc/-/blob/595c0894f630f4fc377c6bf14a5fb88ca0f1398c/m4/fptools_set_haskell_platform_vars.m4#L159). This was carried out in !4194 (closed), which attributes the disabling to https://github.com/llvm/llvm-project/blob/7d1ff446b6ad94560e87900c11370de12c734282/llvm/lib/MC/MachObjectWriter.cpp#L692-L724.
While I've only given this a cursory look, it appears that LLVM's assembler assumes that symbol differences cannot be reliably computed when subsections-via-symbols is enabled on AArch64/Darwin. It's not entirely clear why or whether this is a fundamental limitation of the object format.