aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/CBuiltins.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2020-12-23 15:54:51 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2020-12-26 18:44:28 +0100
commitc50680bb86564fe61db61e6140a418ccc7d36677 (patch)
tree58f8731421325939c93546df3c9046fbf96a051e /aarch64/CBuiltins.ml
parent73551e058a850297bc72924a69b39affcfa49dfa (diff)
downloadcompcert-kvx-c50680bb86564fe61db61e6140a418ccc7d36677.tar.gz
compcert-kvx-c50680bb86564fe61db61e6140a418ccc7d36677.zip
AArch64: macOS port
This commit adds support for macOS (and probably iOS) running on AArch64 / ARM 64-bit / "Apple silicon" processors.
Diffstat (limited to 'aarch64/CBuiltins.ml')
-rw-r--r--aarch64/CBuiltins.ml26
1 files changed, 19 insertions, 7 deletions
diff --git a/aarch64/CBuiltins.ml b/aarch64/CBuiltins.ml
index e2a9c87a..4ba7e5ae 100644
--- a/aarch64/CBuiltins.ml
+++ b/aarch64/CBuiltins.ml
@@ -17,16 +17,28 @@
open C
-(* va_list is a struct of size 32 and alignment 8, passed by reference *)
+(* AAPCS64:
+ va_list is a struct of size 32 and alignment 8, passed by reference
+ Apple:
+ va_list is a pointer (size 8, alignment 8), passed by reference *)
-let va_list_type = TArray(TInt(IULong, []), Some 4L, [])
-let size_va_list = 32
-let va_list_scalar = false
+let (va_list_type, size_va_list, va_list_scalar) =
+ match Archi.abi with
+ | Archi.AAPCS64 -> (TArray(TInt(IULong, []), Some 4L, []), 32, false)
+ | Archi.Apple -> (TPtr(TVoid [], []), 8, true)
+
+(* Some macOS headers use the GCC built-in types "__int128_t" and
+ "__uint128_t" unconditionally. Provide a dummy definition. *)
+
+let int128_type = TArray(TInt(IULong, []), Some 2L, [])
let builtins = {
- builtin_typedefs = [
- "__builtin_va_list", va_list_type
- ];
+ builtin_typedefs =
+ [ "__builtin_va_list", va_list_type ] @
+ (if Configuration.system = "macosx" then
+ [ "__int128_t", int128_type;
+ "__uint128_t", int128_type ]
+ else []);
builtin_functions = [
(* Synchronization *)
"__builtin_fence",