Skip to content

Instantly share code, notes, and snippets.

@hjelmn
Last active January 2, 2021 03:31
Show Gist options
  • Save hjelmn/49f70df40da0399006031d854f73473e to your computer and use it in GitHub Desktop.
Save hjelmn/49f70df40da0399006031d854f73473e to your computer and use it in GitHub Desktop.
diff -urN ghc-8.10.3/aclocal.m4 ghc-8.10.3.new/aclocal.m4
--- ghc-8.10.3/aclocal.m4 2020-12-13 15:11:57.000000000 -0700
+++ ghc-8.10.3.new/aclocal.m4 2021-01-01 12:25:29.000000000 -0700
@@ -118,7 +118,7 @@
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 @@
test -z "[$]2" || eval "[$]2=\"ArchARM {armISA = \$ARM_ISA, armISAExt = \$ARM_ISA_EXT, armABI = \$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_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)])
@@ -1945,7 +1950,7 @@
# converts cpu from gnu to ghc naming, and assigns the result to $target_var
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
- aarch64*)
+ aarch64*|arm64*)
$2="aarch64"
;;
alpha*)
@@ -2027,18 +2032,19 @@
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 someting 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"
@@ -2049,15 +2055,25 @@
# 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"
])
diff -urN ghc-8.10.3/compiler/GHC/Platform/AArch64.hs ghc-8.10.3.new/compiler/GHC/Platform/AArch64.hs
--- ghc-8.10.3/compiler/GHC/Platform/AArch64.hs 1969-12-31 17:00:00.000000000 -0700
+++ ghc-8.10.3.new/compiler/GHC/Platform/AArch64.hs 2021-01-01 12:37:28.000000000 -0700
@@ -0,0 +1,9 @@
+{-# LANGUAGE CPP #-}
+
+module GHC.Platform.AArch64 where
+
+import GhcPrelude
+
+#define MACHREGS_NO_REGS 0
+#define MACHREGS_aarch64 1
+#include "../../../includes/CodeGen.Platform.hs"
diff -urN ghc-8.10.3/compiler/GHC/Platform/ARM64.hs ghc-8.10.3.new/compiler/GHC/Platform/ARM64.hs
--- ghc-8.10.3/compiler/GHC/Platform/ARM64.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/GHC/Platform/ARM64.hs 1969-12-31 17:00:00.000000000 -0700
@@ -1,10 +0,0 @@
-{-# LANGUAGE CPP #-}
-
-module GHC.Platform.ARM64 where
-
-import GhcPrelude
-
-#define MACHREGS_NO_REGS 0
-#define MACHREGS_aarch64 1
-#include "../../../includes/CodeGen.Platform.hs"
-
diff -urN ghc-8.10.3/compiler/GHC/Platform/Regs.hs ghc-8.10.3.new/compiler/GHC/Platform/Regs.hs
--- ghc-8.10.3/compiler/GHC/Platform/Regs.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/GHC/Platform/Regs.hs 2021-01-01 12:17:05.000000000 -0700
@@ -1,4 +1,3 @@
-
module GHC.Platform.Regs
(callerSaves, activeStgRegs, haveRegBase, globalRegMaybe, freeReg)
where
@@ -10,7 +9,7 @@
import 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 @@
| 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 @@
| 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 @@
| 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 @@
| 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 @@
| 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
-
diff -urN ghc-8.10.3/compiler/cmm/PprC.hs ghc-8.10.3.new/compiler/cmm/PprC.hs
--- ghc-8.10.3/compiler/cmm/PprC.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/cmm/PprC.hs 2021-01-01 12:38:50.000000000 -0700
@@ -1164,7 +1164,7 @@
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
diff -urN ghc-8.10.3/compiler/ghc.cabal.in ghc-8.10.3.new/compiler/ghc.cabal.in
--- ghc-8.10.3/compiler/ghc.cabal.in 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/ghc.cabal.in 2021-01-01 12:38:05.000000000 -0700
@@ -291,7 +291,7 @@
Bitmap
GHC.Platform.Regs
GHC.Platform.ARM
- GHC.Platform.ARM64
+ GHC.Platform.AArch64
GHC.Platform.NoRegs
GHC.Platform.PPC
GHC.Platform.S390X
diff -urN ghc-8.10.3/compiler/main/DriverPipeline.hs ghc-8.10.3.new/compiler/main/DriverPipeline.hs
--- ghc-8.10.3/compiler/main/DriverPipeline.hs 2020-12-04 13:04:01.000000000 -0700
+++ ghc-8.10.3.new/compiler/main/DriverPipeline.hs 2021-01-01 13:17:17.000000000 -0700
@@ -1857,7 +1857,7 @@
ArchX86 -> True
ArchX86_64 -> True
ArchARM {} -> True
- ArchARM64 -> True
+ ArchAArch64 -> True
_ -> False
then ["-Wl,-no_compact_unwind"]
else [])
diff -urN ghc-8.10.3/compiler/nativeGen/AsmCodeGen.hs ghc-8.10.3.new/compiler/nativeGen/AsmCodeGen.hs
--- ghc-8.10.3/compiler/nativeGen/AsmCodeGen.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/nativeGen/AsmCodeGen.hs 2021-01-01 12:36:42.000000000 -0700
@@ -172,7 +172,7 @@
ArchSPARC -> nCG' (sparcNcgImpl dflags)
ArchSPARC64 -> panic "nativeCodeGen: No NCG for SPARC64"
ArchARM {} -> panic "nativeCodeGen: No NCG for ARM"
- ArchARM64 -> panic "nativeCodeGen: No NCG for ARM64"
+ ArchAArch64 -> panic "nativeCodeGen: No NCG for AArch64"
ArchPPC_64 _ -> nCG' (ppcNcgImpl dflags)
ArchAlpha -> panic "nativeCodeGen: No NCG for Alpha"
ArchMipseb -> panic "nativeCodeGen: No NCG for mipseb"
diff -urN ghc-8.10.3/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
--- ghc-8.10.3/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs 2021-01-01 12:16:51.000000000 -0700
@@ -115,7 +115,7 @@
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 @@
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 @@
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"
diff -urN ghc-8.10.3/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
--- ghc-8.10.3/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs 2021-01-01 12:39:12.000000000 -0700
@@ -79,7 +79,7 @@
ArchSPARC -> SPARC.Instr.maxSpillSlots dflags
ArchSPARC64 -> panic "maxSpillSlots ArchSPARC64"
ArchARM _ _ _ -> panic "maxSpillSlots ArchARM"
- ArchARM64 -> panic "maxSpillSlots ArchARM64"
+ ArchAArch64 -> panic "maxSpillSlots ArchAArch64"
ArchPPC_64 _ -> PPC.Instr.maxSpillSlots dflags
ArchAlpha -> panic "maxSpillSlots ArchAlpha"
ArchMipseb -> panic "maxSpillSlots ArchMipseb"
diff -urN ghc-8.10.3/compiler/nativeGen/RegAlloc/Linear/Main.hs ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Linear/Main.hs
--- ghc-8.10.3/compiler/nativeGen/RegAlloc/Linear/Main.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/nativeGen/RegAlloc/Linear/Main.hs 2021-01-01 13:17:53.000000000 -0700
@@ -216,7 +216,7 @@
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"
diff -urN ghc-8.10.3/compiler/nativeGen/TargetReg.hs ghc-8.10.3.new/compiler/nativeGen/TargetReg.hs
--- ghc-8.10.3/compiler/nativeGen/TargetReg.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/compiler/nativeGen/TargetReg.hs 2021-01-01 12:40:01.000000000 -0700
@@ -49,7 +49,7 @@
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"
@@ -68,7 +68,7 @@
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"
@@ -86,7 +86,7 @@
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"
@@ -104,7 +104,7 @@
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"
@@ -122,7 +122,7 @@
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"
diff -urN ghc-8.10.3/configure ghc-8.10.3.new/configure
--- ghc-8.10.3/configure 2020-12-18 19:42:17.000000000 -0700
+++ ghc-8.10.3.new/configure 2021-01-01 13:31:48.000000000 -0700
@@ -3560,7 +3560,7 @@
else
case "$build_cpu" in
- aarch64*)
+ aarch64*|arm64*)
BuildArch="aarch64"
;;
alpha*)
@@ -3725,7 +3725,7 @@
else
case "$host_cpu" in
- aarch64*)
+ aarch64*|arm64*)
HostArch="aarch64"
;;
alpha*)
@@ -3879,7 +3879,7 @@
then
case "$host_cpu" in
- aarch64*)
+ aarch64*|arm64*)
TargetArch="aarch64"
;;
alpha*)
@@ -4042,7 +4042,7 @@
else
case "$target_cpu" in
- aarch64*)
+ aarch64*|arm64*)
TargetArch="aarch64"
;;
alpha*)
@@ -4191,12 +4191,13 @@
fi
- case "$target_vendor-$target_os" in
+ llvm_target_cpu=$target_cpu
+ case "$target" in
*-freebsd*-gnueabihf)
llvm_target_vendor="unknown"
llvm_target_os="freebsd-gnueabihf"
;;
- hardfloat-*eabi)
+ *-hardfloat-*eabi)
llvm_target_vendor="unknown"
llvm_target_os="$target_os""hf"
;;
@@ -4228,6 +4229,79 @@
llvm_target_os="$target_os"
;;
+ # 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"
+
+ case "$target_vendor" in
+ pc|gentoo|w64) # like i686-pc-linux-gnu, i686-gentoo-freebsd8, x86_64-w64-mingw32
+ llvm_target_vendor="unknown"
+ ;;
+ softfloat) # like armv5tel-softfloat-linux-gnueabi
+ llvm_target_vendor="unknown"
+ ;;
+ hardfloat) # like armv7a-hardfloat-linux-gnueabi
+ llvm_target_vendor="unknown"
+ ;;
+ *)
+ #pass thru by default
+ llvm_target_vendor="$target_vendor"
+ ;;
+ esac
+
+
+ case "$target_os" in
+ gnu*) # e.g. i686-unknown-gnu0.9
+ llvm_target_os="gnu"
+ ;;
+ # watchos and tvos are ios variants as of May 2017.
+ ios|watchos|tvos)
+ llvm_target_os="ios"
+ ;;
+ linux-android*)
+ llvm_target_os="linux-android"
+ ;;
+ linux-*|linux)
+ llvm_target_os="linux"
+ ;;
+ openbsd*)
+ llvm_target_os="openbsd"
+ ;;
+ # As far as I'm aware, none of these have relevant variants
+ freebsd|netbsd|dragonfly|hpux|linuxaout|kfreebsdgnu|freebsd2|mingw32|darwin|nextstep2|nextstep3|sunos4|ultrix|haiku)
+ llvm_target_os="$target_os"
+ ;;
+ msys)
+ as_fn_error $? "Building GHC using the msys toolchain is not supported; please use mingw instead. Perhaps you need to set 'MSYSTEM=MINGW64 or MINGW32?'" "$LINENO" 5
+ ;;
+ aix*) # e.g. powerpc-ibm-aix7.1.3.0
+ llvm_target_os="aix"
+ ;;
+ darwin*) # e.g. aarch64-apple-darwin14
+ llvm_target_os="darwin"
+ ;;
+ solaris2*)
+ llvm_target_os="solaris2"
+ ;;
+ freebsd*) # like i686-gentoo-freebsd7
+ # i686-gentoo-freebsd8
+ # i686-gentoo-freebsd8.2
+ llvm_target_os="freebsd"
+ ;;
+ nto-qnx*)
+ llvm_target_os="nto-qnx"
+ ;;
+ *)
+ echo "Unknown OS $target_os"
+ exit 1
+ ;;
+ esac
+
+ ;;
*)
case "$target_vendor" in
@@ -4296,7 +4370,7 @@
;;
esac
- LlvmTarget="$target_cpu-$llvm_target_vendor-$llvm_target_os"
+ LlvmTarget="$llvm_target_cpu-$llvm_target_vendor-$llvm_target_os"
@@ -10423,7 +10497,7 @@
test -z "$2" || eval "$2=\"ArchARM {armISA = \$ARM_ISA, armISAExt = \$ARM_ISA_EXT, armABI = \$ARM_ABI}\""
;;
aarch64)
- test -z "$2" || eval "$2=ArchARM64"
+ test -z "$2" || eval "$2=ArchAArch64"
;;
alpha)
test -z "$2" || eval "$2=ArchAlpha"
@@ -10524,10 +10598,14 @@
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- TargetHasSubsectionsViaSymbols=YES
+ if test x"$TargetArch" = xaarch64; then
+ TargetHasSubsectionsViaSymbols=NO
+ else
+ TargetHasSubsectionsViaSymbols=YES
$as_echo "#define HAVE_SUBSECTIONS_VIA_SYMBOLS 1" >>confdefs.h
+ fi
else
TargetHasSubsectionsViaSymbols=NO
diff -urN ghc-8.10.3/includes/CodeGen.Platform.hs ghc-8.10.3.new/includes/CodeGen.Platform.hs
--- ghc-8.10.3/includes/CodeGen.Platform.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/includes/CodeGen.Platform.hs 2021-01-01 12:17:05.000000000 -0700
@@ -94,7 +94,7 @@
# 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 = panic "freeReg not defined for this platform"
#endif
-
diff -urN ghc-8.10.3/includes/rts/Flags.h ghc-8.10.3.new/includes/rts/Flags.h
--- ghc-8.10.3/includes/rts/Flags.h 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/includes/rts/Flags.h 2021-01-01 12:17:05.000000000 -0700
@@ -199,6 +199,8 @@
* 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(x86_64_HOST_ARCH) && defined(darwin_HOST_OS)
#define DEFAULT_LINKER_ALWAYS_PIC true
diff -urN ghc-8.10.3/includes/rts/storage/GC.h ghc-8.10.3.new/includes/rts/storage/GC.h
--- ghc-8.10.3/includes/rts/storage/GC.h 2020-12-04 13:04:01.000000000 -0700
+++ ghc-8.10.3.new/includes/rts/storage/GC.h 2021-01-01 12:17:05.000000000 -0700
@@ -199,7 +199,7 @@
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);
diff -urN ghc-8.10.3/includes/stg/Regs.h ghc-8.10.3.new/includes/stg/Regs.h
--- ghc-8.10.3/includes/stg/Regs.h 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/includes/stg/Regs.h 2021-01-01 16:07:01.000000000 -0700
@@ -442,7 +442,7 @@
#error BaseReg must be in a register for THREADED_RTS
#endif
#define BaseReg (&((struct PartCapability_ *)MainCapability)->r)
-#define ASSIGN_BaseReg(e) (e)
+#define ASSIGN_BaseReg(e) (void)(e)
#endif
#if defined(REG_Sp) && !defined(NO_GLOBAL_REG_DECLS)
diff -urN ghc-8.10.3/libraries/ghc-boot/GHC/Platform.hs ghc-8.10.3.new/libraries/ghc-boot/GHC/Platform.hs
--- ghc-8.10.3/libraries/ghc-boot/GHC/Platform.hs 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/libraries/ghc-boot/GHC/Platform.hs 2021-01-01 13:19:13.000000000 -0700
@@ -114,7 +114,7 @@
, armISAExt :: [ArmISAExt]
, armABI :: ArmABI
}
- | ArchARM64
+ | ArchAArch64
| ArchAlpha
| ArchMipseb
| ArchMipsel
@@ -155,7 +155,7 @@
ARMv5 -> "v5"
ARMv6 -> "v6"
ARMv7 -> "v7"
- ArchARM64 -> "aarch64"
+ ArchAArch64 -> "aarch64"
ArchAlpha -> "alpha"
ArchMipseb -> "mipseb"
ArchMipsel -> "mipsel"
@@ -163,7 +163,7 @@
isARM :: Arch -> Bool
isARM (ArchARM {}) = True
-isARM ArchARM64 = True
+isARM ArchAArch64 = True
isARM _ = False
-- | Operating systems that the native code generator knows about.
diff -urN ghc-8.10.3/libraries/ghci/GHCi/InfoTable.hsc ghc-8.10.3.new/libraries/ghci/GHCi/InfoTable.hsc
--- ghc-8.10.3/libraries/ghci/GHCi/InfoTable.hsc 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/libraries/ghci/GHCi/InfoTable.hsc 2021-01-01 12:27:24.000000000 -0700
@@ -73,7 +73,7 @@
| ArchX86_64
| ArchAlpha
| ArchARM
- | ArchARM64
+ | ArchAArch64
| ArchPPC64
| ArchPPC64LE
| ArchS390X
@@ -95,7 +95,7 @@
#elif defined(arm_HOST_ARCH)
ArchARM
#elif defined(aarch64_HOST_ARCH)
- ArchARM64
+ ArchAArch64
#elif defined(powerpc64_HOST_ARCH)
ArchPPC64
#elif defined(powerpc64le_HOST_ARCH)
@@ -211,7 +211,7 @@
, 0x11, 0xff, 0x2f, 0xe1
, byte0 w32, byte1 w32, byte2 w32, byte3 w32]
- ArchARM64 { } ->
+ ArchAArch64 { } ->
-- Generates:
--
-- ldr x1, label
diff -urN ghc-8.10.3/libraries/integer-gmp/gmp/gmpsrc.patch ghc-8.10.3.new/libraries/integer-gmp/gmp/gmpsrc.patch
--- ghc-8.10.3/libraries/integer-gmp/gmp/gmpsrc.patch 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/libraries/integer-gmp/gmp/gmpsrc.patch 2021-01-01 14:34:12.000000000 -0700
@@ -1,16 +1,70 @@
-diff -Naur gmp-6.1.2/configure gmpbuild/configure
---- gmp-6.1.2/configure 2016-12-16 10:45:32.000000000 -0500
-+++ gmpbuild/configure 2017-01-29 15:18:01.037775639 -0500
-@@ -28181,7 +28181,7 @@
+diff -Naur gmp-6.2.1/Makefile.am gmpbuild/Makefile.am
+--- gmp-6.2.1/Makefile.am 2020-11-14 11:45:09.000000000 -0700
++++ gmpbuild/Makefile.am 2020-11-19 22:53:46.000000000 -0700
+@@ -112,7 +112,7 @@
+ LIBGMPXX_LT_AGE = 6
+
+
+-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
++SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
+
+ EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
+ COPYING.LESSERv3 COPYINGv2 COPYINGv3
+diff -Naur gmp-6.2.1/Makefile.in gmpbuild/Makefile.in
+--- gmp-6.2.1/Makefile.in 2020-11-14 11:45:16.000000000 -0700
++++ gmpbuild/Makefile.in 2020-11-19 22:58:19.000000000 -0700
+@@ -572,7 +572,7 @@
+ LIBGMPXX_LT_CURRENT = 10
+ LIBGMPXX_LT_REVISION = 1
+ LIBGMPXX_LT_AGE = 6
+-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
++SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
+
+ # Put asl.h here for now.
+
+diff -Naur gmp-6.2.1/configure gmpbuild/configure
+--- gmp-6.2.1/configure 2020-11-14 11:45:15.000000000 -0700
++++ gmpbuild/configure 2020-11-19 23:00:13.000000000 -0700
+@@ -4088,8 +4088,8 @@
+ #
+ cclist="gcc cc"
+
+-gcc_cflags="-O2 -pedantic"
+-gcc_64_cflags="-O2 -pedantic"
++gcc_cflags="-O2 -pedantic -fPIC"
++gcc_64_cflags="-O2 -pedantic -fPIC"
+ cc_cflags="-O"
+ cc_64_cflags="-O"
+
+@@ -26220,6 +26220,8 @@
+ 64)
+ case $host in
+ *-*-darwin*)
++echo "define(<PIC_ALWAYS>,<yes>)" >> $gmp_tmpconfigm4
++
+
+ echo "include_mpn(\`arm64/darwin.m4')" >> $gmp_tmpconfigm4i
+ ;;
+@@ -27176,6 +27178,9 @@
+ case $host in
+ *-*-darwin*)
+
++echo "define(<PIC_ALWAYS>,<yes>)" >> $gmp_tmpconfigm4
++
++
+ echo "include_mpn(\`x86_64/darwin.m4')" >> $gmp_tmpconfigm4i
+ ;;
+ *-*-mingw* | *-*-msys | *-*-cygwin)
+@@ -27985,7 +27990,7 @@
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
--ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in"
-+ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in"
+-ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in gmp.pc:gmp.pc.in gmpxx.pc:gmpxx.pc.in"
++ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in gmp.pc:gmp.pc.in gmpxx.pc:gmpxx.pc.in"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
-@@ -29325,7 +29325,6 @@
+@@ -29129,7 +29134,6 @@
"tests/rand/Makefile") CONFIG_FILES="$CONFIG_FILES tests/rand/Makefile" ;;
"tests/misc/Makefile") CONFIG_FILES="$CONFIG_FILES tests/misc/Makefile" ;;
"tests/cxx/Makefile") CONFIG_FILES="$CONFIG_FILES tests/cxx/Makefile" ;;
@@ -18,27 +72,26 @@
"tune/Makefile") CONFIG_FILES="$CONFIG_FILES tune/Makefile" ;;
"demos/Makefile") CONFIG_FILES="$CONFIG_FILES demos/Makefile" ;;
"demos/calc/Makefile") CONFIG_FILES="$CONFIG_FILES demos/calc/Makefile" ;;
-diff -Naur gmp-6.1.2/Makefile.am gmpbuild/Makefile.am
---- gmp-6.1.2/Makefile.am 2016-12-16 10:45:27.000000000 -0500
-+++ gmpbuild/Makefile.am 2017-01-29 15:14:20.764370926 -0500
-@@ -110,7 +110,7 @@
- LIBGMPXX_LT_AGE = 5
-
+diff -Naur gmp-6.2.1/configure.ac gmpbuild/configure.ac
+--- gmp-6.2.1/configure.ac 2020-11-14 11:45:09.000000000 -0700
++++ gmpbuild/configure.ac 2020-11-19 22:56:58.000000000 -0700
+@@ -3703,6 +3703,7 @@
+ 64)
+ case $host in
+ *-*-darwin*)
++ GMP_DEFINE_RAW(["define(<PIC_ALWAYS>,<yes>)"])
+ GMP_INCLUDE_MPN(arm64/darwin.m4) ;;
+ *)
+ GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;;
+diff -Naur gmp-6.2.1/mpn/asm-defs.m4 gmpbuild/mpn/asm-defs.m4
+--- gmp-6.2.1/mpn/asm-defs.m4 2020-11-14 11:45:09.000000000 -0700
++++ gmpbuild/mpn/asm-defs.m4 2020-11-19 22:53:46.000000000 -0700
+@@ -1051,7 +1051,7 @@
+ dnl systems which are always PIC. PIC_ALWAYS established in config.m4
+ dnl identifies these for us.
--SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
-+SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
+-ifelse(`PIC_ALWAYS',`yes',`define(`PIC')')
++ifelse(PIC_ALWAYS,yes,`define(`PIC')')
- EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
- COPYING.LESSERv3 COPYINGv2 COPYINGv3
-diff -Naur gmp-6.1.2/Makefile.in gmpbuild/Makefile.in
---- gmp-6.1.2/Makefile.in 2016-12-16 10:45:34.000000000 -0500
-+++ gmpbuild/Makefile.in 2017-01-29 15:14:32.596446554 -0500
-@@ -566,7 +566,7 @@
- LIBGMPXX_LT_CURRENT = 9
- LIBGMPXX_LT_REVISION = 2
- LIBGMPXX_LT_AGE = 5
--SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
-+SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune
- # The "test -f" support for srcdir!=builddir is similar to the automake .c.o
- # etc rules, but with each foo.c explicitly, since $< is not portable
+ dnl Various possible defines passed from the Makefile that are to be tested
diff -urN ghc-8.10.3/llvm-targets ghc-8.10.3.new/llvm-targets
--- ghc-8.10.3/llvm-targets 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/llvm-targets 2021-01-01 12:23:44.000000000 -0700
@@ -1,6 +1,7 @@
-[("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", ""))
+[("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"))
@@ -20,28 +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", ""))
-,("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"))
,("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"))
diff -urN ghc-8.10.3/rts/Adjustor.c ghc-8.10.3.new/rts/Adjustor.c
--- ghc-8.10.3/rts/Adjustor.c 2019-11-02 08:49:16.000000000 -0600
+++ ghc-8.10.3.new/rts/Adjustor.c 2021-01-01 12:17:24.000000000 -0700
@@ -99,7 +99,7 @@
{
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;
diff -urN ghc-8.10.3/rts/StgCRun.c ghc-8.10.3.new/rts/StgCRun.c
--- ghc-8.10.3/rts/StgCRun.c 2020-12-04 13:04:01.000000000 -0700
+++ ghc-8.10.3.new/rts/StgCRun.c 2021-01-01 12:17:24.000000000 -0700
@@ -982,7 +982,7 @@
"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"
@@ -991,7 +991,7 @@
*/
"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"
/*
diff -urN ghc-8.10.3/rts/linker/elf_plt_aarch64.c ghc-8.10.3.new/rts/linker/elf_plt_aarch64.c
--- ghc-8.10.3/rts/linker/elf_plt_aarch64.c 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/rts/linker/elf_plt_aarch64.c 2021-01-01 12:17:24.000000000 -0700
@@ -46,8 +46,8 @@
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.
diff -urN ghc-8.10.3/rts/linker/elf_reloc.c ghc-8.10.3.new/rts/linker/elf_reloc.c
--- ghc-8.10.3/rts/linker/elf_reloc.c 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/rts/linker/elf_reloc.c 2021-01-01 12:17:24.000000000 -0700
@@ -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
diff -urN ghc-8.10.3/rts/package.conf.in ghc-8.10.3.new/rts/package.conf.in
--- ghc-8.10.3/rts/package.conf.in 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/rts/package.conf.in 2021-01-01 12:17:24.000000000 -0700
@@ -296,7 +296,7 @@
, "-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
diff -urN ghc-8.10.3/rts/rts.cabal.in ghc-8.10.3.new/rts/rts.cabal.in
--- ghc-8.10.3/rts/rts.cabal.in 2020-12-04 13:04:01.000000000 -0700
+++ ghc-8.10.3.new/rts/rts.cabal.in 2021-01-01 12:17:24.000000000 -0700
@@ -368,7 +368,7 @@
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
diff -urN ghc-8.10.3/rts/sm/Storage.c ghc-8.10.3.new/rts/sm/Storage.c
--- ghc-8.10.3/rts/sm/Storage.c 2020-12-04 13:04:01.000000000 -0700
+++ ghc-8.10.3.new/rts/sm/Storage.c 2021-01-01 12:17:24.000000000 -0700
@@ -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
@@ -1543,7 +1543,7 @@
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
@@ -1574,7 +1574,7 @@
/* x86 doesn't need to do anything, so just suppress some warnings. */
(void)len;
(void)exec_addr;
-#elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && defined(ios_HOST_OS)
+#elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
/* On iOS we need to use the special 'sys_icache_invalidate' call. */
sys_icache_invalidate(exec_addr, len);
#elif defined(__clang__)
@@ -1628,7 +1628,7 @@
RELEASE_SM_LOCK
}
-#elif defined(ios_HOST_OS)
+#elif (defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) && (defined(ios_HOST_OS) || defined(darwin_HOST_OS))
static HashTable* allocatedExecs;
diff -urN ghc-8.10.3/utils/llvm-targets/gen-data-layout.sh ghc-8.10.3.new/utils/llvm-targets/gen-data-layout.sh
--- ghc-8.10.3/utils/llvm-targets/gen-data-layout.sh 2020-12-02 07:16:57.000000000 -0700
+++ ghc-8.10.3.new/utils/llvm-targets/gen-data-layout.sh 2021-01-01 12:17:24.000000000 -0700
@@ -80,9 +80,12 @@
# macOS
"i386-apple-darwin"
"x86_64-apple-darwin"
+ "arm64-apple-darwin"
# iOS
- "armv7-apple-ios arm64-apple-ios"
- "i386-apple-ios x86_64-apple-ios"
+ "armv7-apple-ios"
+ "arm64-apple-ios"
+ "i386-apple-ios"
+ "x86_64-apple-ios"
#########################
# FreeBSD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment