summaryrefslogtreecommitdiff
path: root/rts/ghc.mk
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-07-12 17:26:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-27 04:47:51 -0400
commit2ce48fe9d1334dadf6fa1411238e52d65b66ba41 (patch)
tree1f48a9e2e2ae3350c3802875bef128327afdf593 /rts/ghc.mk
parent246f08ac032392f808c7aa53dd78a96d9b43e63f (diff)
downloadhaskell-2ce48fe9d1334dadf6fa1411238e52d65b66ba41.tar.gz
rts: Break up adjustor logic
Diffstat (limited to 'rts/ghc.mk')
-rw-r--r--rts/ghc.mk30
1 files changed, 21 insertions, 9 deletions
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 15854de5aa..d3e533d1f7 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -54,15 +54,31 @@ rts_CMM_SRCS := $(wildcard rts/*.cmm)
# Don't compile .S files when bootstrapping a new arch
ifneq "$(PORTING_HOST)" "YES"
-ifneq "$(findstring $(TargetArch_CPP), i386 powerpc powerpc64)" ""
-rts_S_SRCS += rts/AdjustorAsm.S
-endif
-# this matches substrings of powerpc64le, including "powerpc" and "powerpc64"
-ifneq "$(findstring $(TargetArch_CPP), powerpc64le s390x riscv64)" ""
+
# unregisterised builds use the mini interpreter
ifneq "$(GhcUnregisterised)" "YES"
rts_S_SRCS += rts/StgCRunAsm.S
endif
+
+# select adjustor implementation. This much match the logic in rts.cabal.in.
+ifeq "$(UseLibffiForAdjustors)" "YES"
+rts_C_SRCS += rts/adjustor/LibffiAdjustor.c
+else
+ifneq "$(findstring $(TargetArch_CPP), i386)" ""
+rts_S_SRCS += rts/AdjustorAsm.S
+rts_C_SRCS += rts/adjustor/Nativei386.c
+else
+ifneq "$(findstring $(TargetArch_CPP), x86_64)" ""
+rts_C_SRCS += rts/adjustor/NativeAmd64.c
+else
+ifneq "$(findstring $(TargetArch_CPP), powerpc64le powerpc)" ""
+rts_S_SRCS += rts/AdjustorAsm.S
+rts_C_SRCS += rts/adjustor/NativePowerPC.c
+else
+$(error Target architecture has no native adjustor implementation)
+endif
+endif
+endif
endif
endif
@@ -381,10 +397,6 @@ rts_CC_OPTS += -DNOSMP
rts_HC_OPTS += -optc-DNOSMP
endif
-ifeq "$(UseLibFFIForAdjustors)" "YES"
-rts_CC_OPTS += -DUSE_LIBFFI_FOR_ADJUSTORS
-endif
-
# We *want* type-checking of hand-written cmm.
rts_HC_OPTS += -dcmm-lint