[Git][ghc/ghc][wip/romes/target-has-rts-linker] Move "target has RTS linker" out of settings
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Mon May 8 16:44:34 UTC 2023
Rodrigo Mesquita pushed to branch wip/romes/target-has-rts-linker at Glasgow Haskell Compiler / GHC
Commits:
56471f9a by Rodrigo Mesquita at 2023-05-08T17:44:25+01:00
Move "target has RTS linker" out of settings
We move the "target has RTS linker" information out of configure into a
predicate in GHC, and remove this option from the settings file where it
is unnecessary -- it's information statically known from the platform.
Closes #23361
- - - - -
9 changed files:
- compiler/GHC/Driver/Session.hs
- configure.ac
- distrib/configure.ac.in
- hadrian/bindist/Makefile
- hadrian/bindist/config.mk.in
- hadrian/cfg/system.config.in
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Generate.hs
- hadrian/src/Settings/Builders/RunTest.hs
Changes:
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -4727,8 +4727,9 @@ compilerInfo dflags
("Target platform", platformMisc_targetPlatformString $ platformMisc dflags),
("Have interpreter", showBool $ platformMisc_ghcWithInterpreter $ platformMisc dflags),
("Object splitting supported", showBool False),
- ("Have native code generator", showBool $ platformNcgSupported (targetPlatform dflags)),
- ("Target default backend", show $ platformDefaultBackend (targetPlatform dflags)),
+ ("Have native code generator", showBool $ platformNcgSupported platform),
+ ("target has RTS linker", showBool $ platformHasRTSLinker platform),
+ ("Target default backend", show $ platformDefaultBackend platform),
-- Whether or not we support @-dynamic-too@
("Support dynamic-too", showBool $ not isWindows),
-- Whether or not we support the @-j@ flag with @--make at .
@@ -4769,6 +4770,23 @@ compilerInfo dflags
expandDirectories topd mtoold = expandToolDir useInplaceMinGW mtoold . expandTopDir topd
+-- | Does this target have an RTS linker?
+-- Romes: Perhaps not the best place for the function
+platformHasRTSLinker :: Platform -> Bool
+-- NO for powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*|wasm*|javascript-*|loongarch64-*)
+platformHasRTSLinker p = case archOS_arch (platformArchOS p) of
+ ArchPPC -> False -- What about powerpc other than powerpc-ibm-aix*?
+ ArchPPC_64 ELF_V1 -> False -- powerpc64
+ ArchPPC_64 ELF_V2 -> False -- powerpc64le
+ ArchS390X -> False -- What about s390x other than s390x-ibm-linux?
+ ArchRISCV64 -> False
+ ArchLoongArch64 -> False
+ ArchJavaScript -> False
+ ArchWasm32 -> False
+ _ -> True
+
+
+
-- | Get target profile
targetProfile :: DynFlags -> Profile
targetProfile dflags = Profile (targetPlatform dflags) (ways dflags)
=====================================
configure.ac
=====================================
@@ -330,18 +330,6 @@ if test x"$TablesNextToCode" = xYES; then
fi
AC_SUBST(TablesNextToCode)
-dnl ** Does target have runtime linker support?
-dnl --------------------------------------------------------------
-case "$target" in
- powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*|wasm*|javascript-*|loongarch64-*)
- TargetHasRTSLinker=NO
- ;;
- *)
- TargetHasRTSLinker=YES
- ;;
-esac
-AC_SUBST(TargetHasRTSLinker)
-
# Requires FPTOOLS_SET_PLATFORMS_VARS to be run first.
FP_FIND_ROOT
=====================================
distrib/configure.ac.in
=====================================
@@ -20,9 +20,6 @@ bootstrap_target=@TargetPlatform@
bootstrap_llvm_target=@LlvmTarget@
-TargetHasRTSLinker=@TargetHasRTSLinker@
-AC_SUBST(TargetHasRTSLinker)
-
TargetHasLibm=@TargetHasLibm@
AC_SUBST(TargetHasLibm)
=====================================
hadrian/bindist/Makefile
=====================================
@@ -116,7 +116,6 @@ lib/settings : config.mk
@echo ',("target has GNU nonexec stack", "$(TargetHasGnuNonexecStack)")' >> $@
@echo ',("target has .ident directive", "$(TargetHasIdentDirective)")' >> $@
@echo ',("target has subsections via symbols", "$(TargetHasSubsectionsViaSymbols)")' >> $@
- @echo ',("target has RTS linker", "$(TargetHasRTSLinker)")' >> $@
@echo ',("target has libm", "$(TargetHasLibm)")' >> $@
@echo ',("Unregisterised", "$(GhcUnregisterised)")' >> $@
@echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@
=====================================
hadrian/bindist/config.mk.in
=====================================
@@ -253,7 +253,6 @@ TargetWordBigEndian = @TargetWordBigEndian@
TargetHasGnuNonexecStack = @TargetHasGnuNonexecStack@
TargetHasIdentDirective = @TargetHasIdentDirective@
TargetHasSubsectionsViaSymbols = @TargetHasSubsectionsViaSymbols@
-TargetHasRTSLinker = @TargetHasRTSLinker@
TargetHasLibm = @TargetHasLibm@
TablesNextToCode = @TablesNextToCode@
=====================================
hadrian/cfg/system.config.in
=====================================
@@ -173,7 +173,6 @@ target-word-big-endian = @TargetWordBigEndian@
target-has-gnu-nonexec-stack = @TargetHasGnuNonexecStack@
target-has-ident-directive = @TargetHasIdentDirective@
target-has-subsections-via-symbols = @TargetHasSubsectionsViaSymbols@
-target-has-rts-linker = @TargetHasRTSLinker@
target-has-libm = @TargetHasLibm@
target-arm-version = @ARM_ISA@
=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -79,7 +79,6 @@ data Setting = BuildArch
| TargetOsHaskell
| TargetArmVersion
| TargetWordSize
- | TargetHasRtsLinker
| BourneShell
-- TODO: Reduce the variety of similar flags (e.g. CPP and non-CPP versions).
@@ -181,7 +180,6 @@ setting key = lookupSystemConfig $ case key of
TargetArchHaskell -> "target-arch-haskell"
TargetOsHaskell -> "target-os-haskell"
TargetWordSize -> "target-word-size"
- TargetHasRtsLinker -> "target-has-rts-linker"
BourneShell -> "bourne-shell"
bootIsStage0 :: Stage -> Stage
=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -451,7 +451,6 @@ generateSettings = do
, ("target has GNU nonexec stack", expr $ lookupSystemConfig "target-has-gnu-nonexec-stack")
, ("target has .ident directive", expr $ lookupSystemConfig "target-has-ident-directive")
, ("target has subsections via symbols", expr $ lookupSystemConfig "target-has-subsections-via-symbols")
- , ("target has RTS linker", expr $ lookupSystemConfig "target-has-rts-linker")
, ("target has libm", expr $ lookupSystemConfig "target-has-libm")
, ("Unregisterised", expr $ yesNo <$> flag GhcUnregisterised)
, ("LLVM target", getSetting LlvmTarget)
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -126,7 +126,10 @@ inTreeCompilerArgs stg = do
libdir <- System.FilePath.normalise . (top -/-)
<$> stageLibPath stg
- rtsLinker <- (== "YES") <$> setting TargetHasRtsLinker
+ -- romes: Dear reviewer, I'm not sure if it's OK to do this here, but we no
+ -- longer "know" the information, we can only query either ghc --info, or
+ -- the test settings (which indirectly queried the ghc --info)
+ rtsLinker <- getBooleanSetting TestGhcWithRtsLinker
return TestCompilerArgs{..}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/56471f9a4630890c2d545e2102ee19c5d7465da8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/56471f9a4630890c2d545e2102ee19c5d7465da8
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/20230508/a6e52224/attachment-0001.html>
More information about the ghc-commits
mailing list