diff --git a/docs/users_guide/9.2.5-notes.rst b/docs/users_guide/9.2.5-notes.rst index fca1f59d17472301c5b66eda64667c90bc781150..54e5a1a2c65630b5e09bf816312d1f02fc40b9d0 100644 --- a/docs/users_guide/9.2.5-notes.rst +++ b/docs/users_guide/9.2.5-notes.rst @@ -21,6 +21,8 @@ Compiler - Fix a code generation panic when using SIMD types with unboxed sums (:ghc-ticket:`22187`). +- Fix a code generation bug with the native code generator on aarch64 darwin leading to runtime segmentation faults due to an incorrect ABI (:ghc-ticket:`21964`) + Runtime system -------------- diff --git a/includes/CodeGen.Platform.hs b/includes/CodeGen.Platform.hs index 0dfac62a3f125d87fc68d990decfb83c0c511b62..ebec0212bd0f48071ae51673fdeb7b86c156936d 100644 --- a/includes/CodeGen.Platform.hs +++ b/includes/CodeGen.Platform.hs @@ -1028,6 +1028,14 @@ freeReg 29 = False -- ip0 -- used for spill offset computations freeReg 16 = False +#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) +-- x18 is reserved by the platform on Darwin/iOS, and can not be used +-- More about ARM64 ABI that Apple platforms support: +-- https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms +-- https://github.com/Siguza/ios-resources/blob/master/bits/arm64.md +freeReg 18 = False +#endif + # if defined(REG_Base) freeReg REG_Base = False # endif