Commit 8887102f authored by Moritz Angermann's avatar Moritz Angermann Committed by Marge Bot

AArch64/arm64 adjustments

This addes the necessary logic to support aarch64 on elf, as well
as aarch64 on mach-o, which Apple calls arm64.

We change architecture name to AArch64, which is the official arm
naming scheme.
parent 645444af
Pipeline #27509 canceled with stages
......@@ -528,6 +528,14 @@ validate-x86_64-darwin:
tags:
- aarch64-linux
.build-aarch64-linux-deb10-llvm:
extends: .build-aarch64-linux-deb10
stage: full-build
variables:
BUILD_FLAVOUR: perf-llvm
tags:
- aarch64-linux
validate-aarch64-linux-deb10:
extends: .build-aarch64-linux-deb10
artifacts:
......
......@@ -118,7 +118,7 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
GHC_CONVERT_OS([$target_os], [$TargetArch], [TargetOS])
fi
GHC_LLVM_TARGET([$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])
GHC_SELECT_FILE_EXTENSIONS([$host], [exeext_host], [soext_host])
GHC_SELECT_FILE_EXTENSIONS([$target], [exeext_target], [soext_target])
......@@ -218,7 +218,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
test -z "[$]2" || eval "[$]2=\"ArchARM \$ARM_ISA \$ARM_ISA_EXT \$ARM_ABI\""
;;
aarch64)
test -z "[$]2" || eval "[$]2=ArchARM64"
test -z "[$]2" || eval "[$]2=ArchAArch64"
;;
alpha)
test -z "[$]2" || eval "[$]2=ArchAlpha"
......@@ -327,9 +327,14 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [__asm__ (".subsections_via_symbols");])],
[AC_MSG_RESULT(yes)
TargetHasSubsectionsViaSymbols=YES
AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
if test x"$TargetArch" = xaarch64; then
dnl subsections via symbols is busted on arm64
TargetHasSubsectionsViaSymbols=NO
else
TargetHasSubsectionsViaSymbols=YES
AC_DEFINE([HAVE_SUBSECTIONS_VIA_SYMBOLS],[1],
[Define to 1 if Apple-style dead-stripping is supported.])
fi
],
[TargetHasSubsectionsViaSymbols=NO
AC_MSG_RESULT(no)])
......@@ -1976,7 +1981,7 @@ AC_MSG_CHECKING(for path to top of build tree)
# `libraries/base/System/Info.hs`'s documentation.
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
aarch64*)
aarch64*|arm64*)
$2="aarch64"
;;
alpha*)
......@@ -2058,18 +2063,19 @@ case "$1" in
esac
])
# GHC_LLVM_TARGET(target_cpu, target_vendor, target_os, llvm_target_var)
# GHC_LLVM_TARGET(target, target_cpu, target_vendor, target_os, llvm_target_var)
# --------------------------------
# converts the canonicalized target into something llvm can understand
AC_DEFUN([GHC_LLVM_TARGET], [
case "$2-$3" in
llvm_target_cpu=$2
case "$1" in
*-freebsd*-gnueabihf)
llvm_target_vendor="unknown"
llvm_target_os="freebsd-gnueabihf"
;;
hardfloat-*eabi)
*-hardfloat-*eabi)
llvm_target_vendor="unknown"
llvm_target_os="$3""hf"
llvm_target_os="$4""hf"
;;
*-mingw32|*-mingw64|*-msys)
llvm_target_vendor="unknown"
......@@ -2080,15 +2086,25 @@ AC_DEFUN([GHC_LLVM_TARGET], [
# turned into just `-linux` and fail to be found
# in the `llvm-targets` file.
*-android*|*-gnueabi*|*-musleabi*)
GHC_CONVERT_VENDOR([$2],[llvm_target_vendor])
llvm_target_os="$3"
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
llvm_target_os="$4"
;;
# apple is a bit about their naming scheme for
# aarch64; and clang on macOS doesn't know that
# aarch64 would be arm64. So for LLVM we'll need
# to call it arm64; while we'll refer to it internally
# as aarch64 for consistency and sanity.
aarch64-apple-*|arm64-apple-*)
llvm_target_cpu="arm64"
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
;;
*)
GHC_CONVERT_VENDOR([$2],[llvm_target_vendor])
GHC_CONVERT_OS([$3],[$1],[llvm_target_os])
GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
;;
esac
$4="$1-$llvm_target_vendor-$llvm_target_os"
$5="$llvm_target_cpu-$llvm_target_vendor-$llvm_target_os"
])
......
......@@ -166,7 +166,7 @@ nativeCodeGen dflags this_mod modLoc h us cmms
ArchSPARC64 -> panic "nativeCodeGen: No NCG for SPARC64"
ArchS390X -> panic "nativeCodeGen: No NCG for S390X"
ArchARM {} -> panic "nativeCodeGen: No NCG for ARM"
ArchARM64 -> panic "nativeCodeGen: No NCG for ARM64"
ArchAArch64 -> panic "nativeCodeGen: No NCG for AArch64"
ArchAlpha -> panic "nativeCodeGen: No NCG for Alpha"
ArchMipseb -> panic "nativeCodeGen: No NCG for mipseb"
ArchMipsel -> panic "nativeCodeGen: No NCG for mipsel"
......@@ -1193,4 +1193,3 @@ initNCGConfig dflags this_mod = NCGConfig
, ncgDwarfStripBlockInfo = debugLevel dflags < 2 -- We strip out block information when running with -g0 or -g1.
, ncgDwarfSourceNotes = debugLevel dflags >= 3 -- We produce GHC-specific source-note DIEs only with -g3
}
......@@ -115,7 +115,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcInteger conflicts excl
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 15
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
......@@ -146,7 +146,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcFloat conflicts exclus
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 0
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
......@@ -179,7 +179,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcDouble conflicts exclu
ArchSPARC64 -> panic "trivColorable ArchSPARC64"
ArchPPC_64 _ -> 20
ArchARM _ _ _ -> panic "trivColorable ArchARM"
ArchARM64 -> panic "trivColorable ArchARM64"
ArchAArch64 -> panic "trivColorable ArchAArch64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
......
......@@ -223,7 +223,7 @@ linearRegAlloc config entry_ids block_live sccs
ArchSPARC64 -> panic "linearRegAlloc ArchSPARC64"
ArchPPC -> go $ (frInitFreeRegs platform :: PPC.FreeRegs)
ArchARM _ _ _ -> panic "linearRegAlloc ArchARM"
ArchARM64 -> panic "linearRegAlloc ArchARM64"
ArchAArch64 -> panic "linearRegAlloc ArchAArch64"
ArchPPC_64 _ -> go $ (frInitFreeRegs platform :: PPC.FreeRegs)
ArchAlpha -> panic "linearRegAlloc ArchAlpha"
ArchMipseb -> panic "linearRegAlloc ArchMipseb"
......
......@@ -78,7 +78,7 @@ maxSpillSlots config = case platformArch (ncgPlatform config) of
ArchSPARC -> SPARC.Instr.maxSpillSlots config
ArchSPARC64 -> panic "maxSpillSlots ArchSPARC64"
ArchARM _ _ _ -> panic "maxSpillSlots ArchARM"
ArchARM64 -> panic "maxSpillSlots ArchARM64"
ArchAArch64 -> panic "maxSpillSlots ArchAArch64"
ArchPPC_64 _ -> PPC.Instr.maxSpillSlots config
ArchAlpha -> panic "maxSpillSlots ArchAlpha"
ArchMipseb -> panic "maxSpillSlots ArchMipseb"
......
......@@ -48,7 +48,7 @@ targetVirtualRegSqueeze platform
ArchSPARC64 -> panic "targetVirtualRegSqueeze ArchSPARC64"
ArchPPC_64 _ -> PPC.virtualRegSqueeze
ArchARM _ _ _ -> panic "targetVirtualRegSqueeze ArchARM"
ArchARM64 -> panic "targetVirtualRegSqueeze ArchARM64"
ArchAArch64 -> panic "targetVirtualRegSqueeze ArchAArch64"
ArchAlpha -> panic "targetVirtualRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetVirtualRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetVirtualRegSqueeze ArchMipsel"
......@@ -67,7 +67,7 @@ targetRealRegSqueeze platform
ArchSPARC64 -> panic "targetRealRegSqueeze ArchSPARC64"
ArchPPC_64 _ -> PPC.realRegSqueeze
ArchARM _ _ _ -> panic "targetRealRegSqueeze ArchARM"
ArchARM64 -> panic "targetRealRegSqueeze ArchARM64"
ArchAArch64 -> panic "targetRealRegSqueeze ArchAArch64"
ArchAlpha -> panic "targetRealRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetRealRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetRealRegSqueeze ArchMipsel"
......@@ -85,7 +85,7 @@ targetClassOfRealReg platform
ArchSPARC64 -> panic "targetClassOfRealReg ArchSPARC64"
ArchPPC_64 _ -> PPC.classOfRealReg
ArchARM _ _ _ -> panic "targetClassOfRealReg ArchARM"
ArchARM64 -> panic "targetClassOfRealReg ArchARM64"
ArchAArch64 -> panic "targetClassOfRealReg ArchAArch64"
ArchAlpha -> panic "targetClassOfRealReg ArchAlpha"
ArchMipseb -> panic "targetClassOfRealReg ArchMipseb"
ArchMipsel -> panic "targetClassOfRealReg ArchMipsel"
......@@ -103,7 +103,7 @@ targetMkVirtualReg platform
ArchSPARC64 -> panic "targetMkVirtualReg ArchSPARC64"
ArchPPC_64 _ -> PPC.mkVirtualReg
ArchARM _ _ _ -> panic "targetMkVirtualReg ArchARM"
ArchARM64 -> panic "targetMkVirtualReg ArchARM64"
ArchAArch64 -> panic "targetMkVirtualReg ArchAArch64"
ArchAlpha -> panic "targetMkVirtualReg ArchAlpha"
ArchMipseb -> panic "targetMkVirtualReg ArchMipseb"
ArchMipsel -> panic "targetMkVirtualReg ArchMipsel"
......@@ -121,7 +121,7 @@ targetRegDotColor platform
ArchSPARC64 -> panic "targetRegDotColor ArchSPARC64"
ArchPPC_64 _ -> PPC.regDotColor
ArchARM _ _ _ -> panic "targetRegDotColor ArchARM"
ArchARM64 -> panic "targetRegDotColor ArchARM64"
ArchAArch64 -> panic "targetRegDotColor ArchAArch64"
ArchAlpha -> panic "targetRegDotColor ArchAlpha"
ArchMipseb -> panic "targetRegDotColor ArchMipseb"
ArchMipsel -> panic "targetRegDotColor ArchMipsel"
......
......@@ -1158,7 +1158,7 @@ cLoad platform expr rep
bewareLoadStoreAlignment ArchMipseb = True
bewareLoadStoreAlignment ArchMipsel = True
bewareLoadStoreAlignment (ArchARM {}) = True
bewareLoadStoreAlignment ArchARM64 = True
bewareLoadStoreAlignment ArchAArch64 = True
bewareLoadStoreAlignment ArchSPARC = True
bewareLoadStoreAlignment ArchSPARC64 = True
-- Pessimistically assume that they will also cause problems
......
......@@ -3842,8 +3842,8 @@ default_PIC platform =
-- This requires PIC on AArch64, and ExternalDynamicRefs on Linux as on top
-- of that. Subsequently we expect all code on aarch64/linux (and macOS) to
-- be built with -fPIC.
(OSDarwin, ArchARM64) -> [Opt_PIC]
(OSLinux, ArchARM64) -> [Opt_PIC, Opt_ExternalDynamicRefs]
(OSDarwin, ArchAArch64) -> [Opt_PIC]
(OSLinux, ArchAArch64) -> [Opt_PIC, Opt_ExternalDynamicRefs]
(OSOpenBSD, ArchX86_64) -> [Opt_PIC] -- Due to PIE support in
-- OpenBSD since 5.3 release
-- (1 May 2013) we need to
......
......@@ -179,7 +179,7 @@ linkDynLib dflags0 o_files dep_packages
++ [ Option "-undefined",
Option "dynamic_lookup",
Option "-single_module" ]
++ (if platformArch platform == ArchX86_64
++ (if platformArch platform `elem` [ ArchX86_64, ArchAArch64 ]
then [ ]
else [ Option "-Wl,-read_only_relocs,suppress" ])
++ [ Option "-install_name", Option instName ]
......
......@@ -225,9 +225,9 @@ linkBinary' staticLink dflags o_files dep_units = do
(platformOS platform == OSDarwin) &&
case platformArch platform of
ArchX86 -> True
ArchX86_64 -> True
ArchARM {} -> True
ArchARM64 -> True
ArchX86_64 -> True
ArchARM {} -> True
ArchAArch64 -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
......@@ -339,4 +339,3 @@ exeFileName platform staticLink output_fn
else "a.out"
where s <?.> ext | null (takeExtension s) = s <.> ext
| otherwise = s
......@@ -109,7 +109,7 @@ platformOS platform = case platformArchOS platform of
isARM :: Arch -> Bool
isARM (ArchARM {}) = True
isARM ArchARM64 = True
isARM ArchAArch64 = True
isARM _ = False
-- | This predicate tells us whether the platform is 32-bit.
......@@ -232,4 +232,3 @@ platformSOExt platform
OSDarwin -> "dylib"
OSMinGW32 -> "dll"
_ -> "so"
{-# LANGUAGE CPP #-}
module GHC.Platform.ARM64 where
module GHC.Platform.AArch64 where
import GHC.Prelude
#define MACHREGS_NO_REGS 0
#define MACHREGS_aarch64 1
#include "../../../includes/CodeGen.Platform.hs"
module GHC.Platform.Regs
(callerSaves, activeStgRegs, haveRegBase, globalRegMaybe, freeReg)
where
......@@ -10,7 +9,7 @@ import GHC.Platform
import GHC.Platform.Reg
import qualified GHC.Platform.ARM as ARM
import qualified GHC.Platform.ARM64 as ARM64
import qualified GHC.Platform.AArch64 as AArch64
import qualified GHC.Platform.PPC as PPC
import qualified GHC.Platform.S390X as S390X
import qualified GHC.Platform.SPARC as SPARC
......@@ -26,12 +25,12 @@ callerSaves platform
| platformUnregisterised platform = NoRegs.callerSaves
| otherwise
= case platformArch platform of
ArchX86 -> X86.callerSaves
ArchX86_64 -> X86_64.callerSaves
ArchS390X -> S390X.callerSaves
ArchSPARC -> SPARC.callerSaves
ArchARM {} -> ARM.callerSaves
ArchARM64 -> ARM64.callerSaves
ArchX86 -> X86.callerSaves
ArchX86_64 -> X86_64.callerSaves
ArchS390X -> S390X.callerSaves
ArchSPARC -> SPARC.callerSaves
ArchARM {} -> ARM.callerSaves
ArchAArch64 -> AArch64.callerSaves
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.callerSaves
......@@ -48,12 +47,12 @@ activeStgRegs platform
| platformUnregisterised platform = NoRegs.activeStgRegs
| otherwise
= case platformArch platform of
ArchX86 -> X86.activeStgRegs
ArchX86_64 -> X86_64.activeStgRegs
ArchS390X -> S390X.activeStgRegs
ArchSPARC -> SPARC.activeStgRegs
ArchARM {} -> ARM.activeStgRegs
ArchARM64 -> ARM64.activeStgRegs
ArchX86 -> X86.activeStgRegs
ArchX86_64 -> X86_64.activeStgRegs
ArchS390X -> S390X.activeStgRegs
ArchSPARC -> SPARC.activeStgRegs
ArchARM {} -> ARM.activeStgRegs
ArchAArch64 -> AArch64.activeStgRegs
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.activeStgRegs
......@@ -65,12 +64,12 @@ haveRegBase platform
| platformUnregisterised platform = NoRegs.haveRegBase
| otherwise
= case platformArch platform of
ArchX86 -> X86.haveRegBase
ArchX86_64 -> X86_64.haveRegBase
ArchS390X -> S390X.haveRegBase
ArchSPARC -> SPARC.haveRegBase
ArchARM {} -> ARM.haveRegBase
ArchARM64 -> ARM64.haveRegBase
ArchX86 -> X86.haveRegBase
ArchX86_64 -> X86_64.haveRegBase
ArchS390X -> S390X.haveRegBase
ArchSPARC -> SPARC.haveRegBase
ArchARM {} -> ARM.haveRegBase
ArchAArch64 -> AArch64.haveRegBase
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.haveRegBase
......@@ -82,12 +81,12 @@ globalRegMaybe platform
| platformUnregisterised platform = NoRegs.globalRegMaybe
| otherwise
= case platformArch platform of
ArchX86 -> X86.globalRegMaybe
ArchX86_64 -> X86_64.globalRegMaybe
ArchS390X -> S390X.globalRegMaybe
ArchSPARC -> SPARC.globalRegMaybe
ArchARM {} -> ARM.globalRegMaybe
ArchARM64 -> ARM64.globalRegMaybe
ArchX86 -> X86.globalRegMaybe
ArchX86_64 -> X86_64.globalRegMaybe
ArchS390X -> S390X.globalRegMaybe
ArchSPARC -> SPARC.globalRegMaybe
ArchARM {} -> ARM.globalRegMaybe
ArchAArch64 -> AArch64.globalRegMaybe
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.globalRegMaybe
......@@ -99,15 +98,14 @@ freeReg platform
| platformUnregisterised platform = NoRegs.freeReg
| otherwise
= case platformArch platform of
ArchX86 -> X86.freeReg
ArchX86_64 -> X86_64.freeReg
ArchS390X -> S390X.freeReg
ArchSPARC -> SPARC.freeReg
ArchARM {} -> ARM.freeReg
ArchARM64 -> ARM64.freeReg
ArchX86 -> X86.freeReg
ArchX86_64 -> X86_64.freeReg
ArchS390X -> S390X.freeReg
ArchSPARC -> SPARC.freeReg
ArchARM {} -> ARM.freeReg
ArchAArch64 -> AArch64.freeReg
arch
| arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
PPC.freeReg
| otherwise -> NoRegs.freeReg
......@@ -478,7 +478,7 @@ Library
GHC.Parser.Types
GHC.Platform
GHC.Platform.ARM
GHC.Platform.ARM64
GHC.Platform.AArch64
GHC.Platform.Constants
GHC.Platform.NoRegs
GHC.Platform.PPC
......
This diff is collapsed.
......@@ -94,7 +94,7 @@ import GHC.Platform.Reg
# define zmm14 30
# define zmm15 31
-- Note: these are only needed for ARM/ARM64 because globalRegMaybe is now used in CmmSink.hs.
-- Note: these are only needed for ARM/AArch64 because globalRegMaybe is now used in CmmSink.hs.
-- Since it's only used to check 'isJust', the actual values don't matter, thus
-- I'm not sure if these are the correct numberings.
-- Normally, the register names are just stringified as part of the REG() macro
......@@ -1096,4 +1096,3 @@ freeReg _ = True
freeReg = panic "freeReg not defined for this platform"
#endif
......@@ -199,6 +199,8 @@ typedef struct _CONCURRENT_FLAGS {
* When linkerAlwaysPic is true, the runtime linker assume that all object
* files were compiled with -fPIC -fexternal-dynamic-refs and load them
* anywhere in the address space.
* Note that there is no 32bit darwin system we can realistically expect to
* run on or compile for.
*/
#if defined(darwin_HOST_OS) || defined(aarch64_HOST_ARCH)
#define DEFAULT_LINKER_ALWAYS_PIC true
......
......@@ -202,7 +202,7 @@ typedef void* AdjustorExecutable;
AdjustorWritable allocateExec(W_ len, AdjustorExecutable *exec_addr);
void flushExec(W_ len, AdjustorExecutable exec_addr);
#if defined(ios_HOST_OS)
#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
AdjustorWritable execToWritable(AdjustorExecutable exec);
#endif
void freeExec (AdjustorExecutable p);
......
......@@ -41,7 +41,7 @@ data Arch
| ArchSPARC
| ArchSPARC64
| ArchARM ArmISA [ArmISAExt] ArmABI
| ArchARM64
| ArchAArch64
| ArchAlpha
| ArchMipseb
| ArchMipsel
......@@ -130,7 +130,7 @@ stringEncodeArch = \case
ArchARM ARMv5 _ _ -> "armv5"
ArchARM ARMv6 _ _ -> "armv6"
ArchARM ARMv7 _ _ -> "armv7"
ArchARM64 -> "aarch64"
ArchAArch64 -> "aarch64"
ArchAlpha -> "alpha"
ArchMipseb -> "mipseb"
ArchMipsel -> "mipsel"
......
......@@ -69,7 +69,7 @@ data Arch = ArchSPARC
| ArchX86_64
| ArchAlpha
| ArchARM
| ArchARM64
| ArchAArch64
| ArchPPC64
| ArchPPC64LE
| ArchS390X
......@@ -102,7 +102,7 @@ mArch =
#elif defined(arm_HOST_ARCH)
Just ArchARM
#elif defined(aarch64_HOST_ARCH)
Just ArchARM64
Just ArchAArch64
#elif defined(powerpc64_HOST_ARCH)
Just ArchPPC64
#elif defined(powerpc64le_HOST_ARCH)
......@@ -214,7 +214,7 @@ mkJumpToAddr' platform a = case platform of
, 0x11, 0xff, 0x2f, 0xe1
, byte0 w32, byte1 w32, byte2 w32, byte3 w32]
ArchARM64 { } ->
ArchAArch64 { } ->
-- Generates:
--
-- ldr x1, label
......
[("i386-unknown-windows", ("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32", "pentium4", ""))
,("i686-unknown-windows", ("e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32", "pentium4", ""))
,("x86_64-unknown-windows", ("e-m:w-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("arm-unknown-linux-gnueabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+soft-float -fp16 -vfp2 -vfp2sp -vfp2d16 -vfp2d16sp -vfp3 -vfp3sp -vfp3d16 -vfp3d16sp -vfp4 -vfp4sp -vfp4d16 -vfp4d16sp -fp-armv8 -fp-armv8sp -fp-armv8d16 -fp-armv8d16sp -fullfp16 -neon -crypto -dotprod -fp16fml -fp64 -d32 -fpregs +strict-align"))
[("i386-unknown-windows", ("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32", "pentium4", ""))
,("i686-unknown-windows", ("e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32", "pentium4", ""))
,("x86_64-unknown-windows", ("e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("arm-unknown-linux-gnueabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm7tdmi", "+strict-align"))
,("arm-unknown-linux-gnueabihf", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
,("arm-unknown-linux-musleabihf", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
,("armv6-unknown-linux-gnueabihf", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm1136jf-s", "+strict-align"))
......@@ -21,31 +21,32 @@
,("aarch64-unknown-linux-gnu", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("aarch64-unknown-linux-musl", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("aarch64-unknown-linux", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("i386-unknown-linux-gnu", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i386-unknown-linux-musl", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i386-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux-gnu", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux-musl", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux", ("e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("x86_64-unknown-linux-gnu", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux-musl", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux-android", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "+sse4.2 +popcnt +cx16"))
,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+fpregs +vfp2 +vfp2d16 +vfp2d16sp +vfp2sp +vfp3 +vfp3d16 +vfp3d16sp +vfp3sp -fp16 -vfp4 -vfp4d16 -vfp4d16sp -vfp4sp -fp-armv8 -fp-armv8d16 -fp-armv8d16sp -fp-armv8sp -fullfp16 +fp64 +d32 +neon -crypto -fp16fml"))
,("i386-unknown-linux-gnu", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i386-unknown-linux-musl", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i386-unknown-linux", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux-gnu", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux-musl", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("i686-unknown-linux", ("e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", "pentium4", ""))
,("x86_64-unknown-linux-gnu", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux-musl", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-linux-android", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", "+sse4.2 +popcnt +cx16"))
,("armv7-unknown-linux-androideabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+fpregs +vfp2 +vfp2sp +vfp3 +vfp3d16 +vfp3d16sp +vfp3sp -fp16 -vfp4 -vfp4d16 -vfp4d16sp -vfp4sp -fp-armv8 -fp-armv8d16 -fp-armv8d16sp -fp-armv8sp -fullfp16 +fp64 +d32 +neon -crypto -fp16fml"))
,("aarch64-unknown-linux-android", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+fpregs +vfp2 +vfp2d16 +vfp2d16sp +vfp2sp +vfp3 +vfp3d16 +vfp3d16sp +vfp3sp -fp16 -vfp4 -vfp4d16 -vfp4d16sp -vfp4sp -fp-armv8 -fp-armv8d16 -fp-armv8d16sp -fp-armv8sp -fullfp16 +fp64 +d32 +neon -crypto -fp16fml"))
,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+fpregs +vfp2 +vfp2sp +vfp3 +vfp3d16 +vfp3d16sp +vfp3sp -fp16 -vfp4 -vfp4d16 -vfp4d16sp -vfp4sp -fp-armv8 -fp-armv8d16 -fp-armv8d16sp -fp-armv8sp -fullfp16 +fp64 +d32 +neon -crypto -fp16fml"))
,("powerpc64le-unknown-linux-gnu", ("e-m:e-i64:64-n32:64", "ppc64le", ""))
,("powerpc64le-unknown-linux-musl", ("e-m:e-i64:64-n32:64", "ppc64le", "+secure-plt"))
,("powerpc64le-unknown-linux", ("e-m:e-i64:64-n32:64", "ppc64le", ""))
,("s390x-ibm-linux", ("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", "z10", ""))
,("i386-apple-darwin", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
,("x86_64-apple-darwin", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
,("armv7-apple-ios", ("e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", ""))
,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("i386-apple-ios", ("e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
,("x86_64-apple-ios", ("e-m:o-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
,("amd64-portbld-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-freebsd", ("e-m:e-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("i386-apple-darwin", ("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128", "penryn", ""))
,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "penryn", ""))
,("arm64-apple-darwin", ("e-m:o-i64:64-i128:128-n32:64-S128", "vortex", "+v8.3a +fp-armv8 +neon +crc +crypto +fullfp16 +ras +lse +rdm +rcpc +zcm +zcz +sha2 +aes"))
,("armv7-apple-ios", ("e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32", "generic", ""))
,("aarch64-apple-ios", ("e-m:o-i64:64-i128:128-n32:64-S128", "apple-a7", "+fp-armv8 +neon +crypto +zcm +zcz +sha2 +aes"))
,("i386-apple-ios", ("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128", "yonah", ""))
,("x86_64-apple-ios", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "core2", ""))
,("amd64-portbld-freebsd", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("x86_64-unknown-freebsd", ("e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "x86-64", ""))
,("aarch64-unknown-freebsd", ("e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", "generic", "+neon"))
,("armv6-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "arm1176jzf-s", "+strict-align"))
,("armv7-unknown-freebsd-gnueabihf", ("e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", "generic", "+strict-align"))
......
......@@ -99,7 +99,7 @@ freeHaskellFunctionPtr(void* ptr)
{
ffi_closure *cl;
#if defined(ios_HOST_OS)
#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
cl = execToWritable(ptr);
#else
cl = (ffi_closure*)ptr;
......
......@@ -932,7 +932,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
"br %1\n\t"
".globl " STG_RETURN "\n\t"
#if !defined(ios_HOST_OS)
#if !defined(ios_HOST_OS) && !defined(darwin_HOST_OS)
".type " STG_RETURN ", %%function\n"
#endif
STG_RETURN ":\n\t"
......@@ -941,7 +941,7 @@ StgRun(StgFunPtr f, StgRegTable *basereg) {
*/
"add sp, sp, %3\n\t"
/*
* Return the new register table, taking it from Stg's R1 (ARM64's R22).
* Return the new register table, taking it from Stg's R1 (AArch64's R22).
*/
"mov %0, x22\n\t"
/*
......
......@@ -46,8 +46,8 @@ bool needStubForRelaAarch64(Elf_Rela * rela) {
bool
makeStubAarch64(Stub * s) {
// We (the linker) may corrupt registers x16 (IP0) and x17 (IP1) [AAPCS64]
// and the condition flags, according to the "ELF for the ARM64
// Architecture".
// and the condition flags, according to the "ELF for the ARM 64-bit
// Architecture (AArch64)".
//
// [Special purpose regs]
// X16 and X17 are IP0 and IP1, intra-procedure-call temporary registers.
......
......@@ -4,7 +4,7 @@
#if defined(OBJFORMAT_ELF)
/* we currently only use this abstraction for elf/arm64 */
/* we currently only use this abstraction for elf/aarch64 */
#if defined(aarch64_HOST_ARCH)
bool
......
......@@ -318,7 +318,7 @@ ld-options:
, "-Wl,-search_paths_first"
#endif
#if defined(darwin_HOST_OS) && !defined(x86_64_HOST_ARCH)
#if defined(darwin_HOST_OS) && !defined(x86_64_HOST_ARCH) && !defined(aarch64_HOST_ARCH)
, "-read_only_relocs", "warning"
#endif
......
......@@ -398,7 +398,7 @@ library
if os(osx)
ld-options: "-Wl,-search_paths_first"
if !arch(x86_64)
if !arch(x86_64) && !arch(aarch64)
ld-options: -read_only_relocs warning
cmm-sources: Apply.cmm
......
......@@ -30,7 +30,7 @@
#include "GC.h"
#include "Evac.h"
#include "NonMoving.h"
#if defined(ios_HOST_OS)
#if defined(ios_HOST_OS) || defined(darwin_HOST_OS)
#include "Hash.h"
#endif
......@@ -1648,7 +1648,7 @@ StgWord calcTotalCompactW (void)
should be modified to use allocateExec instead of VirtualAlloc.
------------------------------------------------------------------------- */
#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS)
#if (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
#include <libkern/OSCacheControl.h>
#endif
......@@ -1679,7 +1679,7 @@ void flushExec (W_ len, AdjustorExecutable exec_addr)
/* x86 doesn't need to do anything, so just suppress some warnings. */