[Git][ghc/ghc][ghc-9.2] ncg/aarch64: Don't use x18 register on AArch64/Darwin
Zubin (@wz1000)
gitlab at gitlab.haskell.org
Sun Nov 6 18:36:48 UTC 2022
Zubin pushed to branch ghc-9.2 at Glasgow Haskell Compiler / GHC
Commits:
74ca6191 by normalcoder at 2022-11-07T00:06:37+05:30
ncg/aarch64: Don't use x18 register on AArch64/Darwin
Apple's ABI documentation [1] says: "The platforms reserve register x18.
Don’t use this register." While this wasn't problematic in previous
Darwin releases, macOS 13 appears to start zeroing this register
periodically. See #21964.
[1] https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
(cherry picked from commit 67575f2004340564d6e52af055ed6fb43d3f9711)
- - - - -
2 changed files:
- docs/users_guide/9.2.5-notes.rst
- includes/CodeGen.Platform.hs
Changes:
=====================================
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
--------------
=====================================
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
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74ca6191fa0dbbe8cee3dc53741b8d59fbf16b09
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/74ca6191fa0dbbe8cee3dc53741b8d59fbf16b09
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221106/2a72ef15/attachment-0001.html>
More information about the ghc-commits
mailing list