[Git][ghc/ghc][wip/toolchain-selection] Stop configuring into settings unused Ld command

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Mon May 29 20:54:28 UTC 2023



Rodrigo Mesquita pushed to branch wip/toolchain-selection at Glasgow Haskell Compiler / GHC


Commits:
b8cba82b by Rodrigo Mesquita at 2023-05-29T21:53:58+01:00
Stop configuring into settings unused Ld command

- - - - -


12 changed files:

- configure.ac
- ghc/Main.hs
- hadrian/bindist/Makefile
- hadrian/bindist/config.mk.in
- hadrian/cfg/system.config.in
- hadrian/src/Oracles/Setting.hs
- hadrian/src/Rules/Generate.hs
- + m4/fp_prog_ld_filelist.m4
- + m4/fp_prog_ld_flag.m4
- + m4/fp_prog_ld_is_gnu.m4
- + m4/fp_prog_ld_no_compact_unwind.m4
- m4/fp_settings.m4


Changes:

=====================================
configure.ac
=====================================
@@ -1131,7 +1131,6 @@ echo "\
    hs-cpp       : $HaskellCPPCmd
    hs-cpp-flags : $HaskellCPPArgs
    ar           : $ArCmd
-   ld           : $LdCmd
    nm           : $NmCmd
    objdump      : $ObjdumpCmd
    ranlib       : $RanlibCmd


=====================================
ghc/Main.hs
=====================================
@@ -627,8 +627,8 @@ mode_flags =
           "LibDir",
           "Global Package DB",
           "C compiler flags",
-          "C compiler link flags",
-          "ld flags"],
+          "C compiler link flags"
+          ],
     let k' = "-print-" ++ map (replaceSpace . toLower) k
         replaceSpace ' ' = '-'
         replaceSpace c   = c


=====================================
hadrian/bindist/Makefile
=====================================
@@ -89,8 +89,6 @@ lib/settings : config.mk
 	@echo ',("CPP flags", "$(SettingsCPPFlags)")' >> $@
 	@echo ',("Haskell CPP command", "$(SettingsHaskellCPPCommand)")' >> $@
 	@echo ',("Haskell CPP flags", "$(SettingsHaskellCPPFlags)")' >> $@
-	@echo ',("ld command", "$(SettingsLdCommand)")' >> $@
-	@echo ',("ld flags", "$(SettingsLdFlags)")' >> $@
 	@echo ',("ld supports compact unwind", "$(LdHasNoCompactUnwind)")' >> $@
 	@echo ',("ld supports filelist", "$(LdHasFilelist)")' >> $@
 	@echo ',("ld supports response files", "$(LdSupportsResponseFiles)")' >> $@


=====================================
hadrian/bindist/config.mk.in
=====================================
@@ -264,8 +264,6 @@ SettingsCCompilerFlags = @SettingsCCompilerFlags@
 SettingsCxxCompilerFlags = @SettingsCxxCompilerFlags@
 SettingsCCompilerLinkFlags = @SettingsCCompilerLinkFlags@
 SettingsCCompilerSupportsNoPie = @SettingsCCompilerSupportsNoPie@
-SettingsLdCommand = @SettingsLdCommand@
-SettingsLdFlags = @SettingsLdFlags@
 SettingsMergeObjectsCommand = @SettingsMergeObjectsCommand@
 SettingsMergeObjectsFlags = @SettingsMergeObjectsFlags@
 SettingsArCommand = @SettingsArCommand@


=====================================
hadrian/cfg/system.config.in
=====================================
@@ -9,6 +9,7 @@ alex           = @AlexCmd@
 autoreconf     = @AutoreconfCmd@
 cc             = @CC@
 happy          = @HappyCmd@
+ld             = @LD@
 make           = @MakeCmd@
 system-merge-objects = @LD_STAGE0@
 objdump        = @ObjdumpCmd@
@@ -99,8 +100,6 @@ settings-c-compiler-flags = @SettingsCCompilerFlags@
 settings-cxx-compiler-flags = @SettingsCxxCompilerFlags@
 settings-c-compiler-link-flags = @SettingsCCompilerLinkFlags@
 settings-c-compiler-supports-no-pie = @SettingsCCompilerSupportsNoPie@
-settings-ld-command = @SettingsLdCommand@
-settings-ld-flags = @SettingsLdFlags@
 settings-merge-objects-command = @SettingsMergeObjectsCommand@
 settings-merge-objects-flags = @SettingsMergeObjectsFlags@
 settings-ar-command = @SettingsArCommand@


=====================================
hadrian/src/Oracles/Setting.hs
=====================================
@@ -101,8 +101,6 @@ data ToolchainSetting
     | ToolchainSetting_CxxCompilerFlags
     | ToolchainSetting_CCompilerLinkFlags
     | ToolchainSetting_CCompilerSupportsNoPie
-    | ToolchainSetting_LdCommand
-    | ToolchainSetting_LdFlags
     | ToolchainSetting_MergeObjectsCommand
     | ToolchainSetting_MergeObjectsFlags
     | ToolchainSetting_ArCommand
@@ -196,9 +194,6 @@ settingsFileSetting key = case key of
     ToolchainSetting_CxxCompilerFlags       -> queryHostTargetConfig (flags . cxxProgram . tgtCxxCompiler)
     ToolchainSetting_CCompilerLinkFlags     -> queryHostTargetConfig (flags . ccLinkProgram . tgtCCompilerLink)
     ToolchainSetting_CCompilerSupportsNoPie -> queryHostTargetConfig (yesNo . ccLinkSupportsNoPie . tgtCCompilerLink)
-    -- ROMES:TODO: Rename LdCommand to CCLink
-    ToolchainSetting_LdCommand              -> lookupSystemConfig "settings-ld-command"
-    ToolchainSetting_LdFlags                -> lookupSystemConfig "settings-ld-flags"
     ToolchainSetting_MergeObjectsCommand    -> queryHostTargetConfig (maybe "" (cmd . mergeObjsProgram) . tgtMergeObjs)
     ToolchainSetting_MergeObjectsFlags      -> queryHostTargetConfig (maybe "" (flags . mergeObjsProgram) . tgtMergeObjs)
     ToolchainSetting_ArCommand              -> queryHostTargetConfig (cmd . arMkArchive . tgtAr)


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -427,8 +427,6 @@ generateSettings = do
         , ("CPP flags", expr $ settingsFileSetting ToolchainSetting_CPPFlags)
         , ("Haskell CPP command", expr $ settingsFileSetting ToolchainSetting_HaskellCPPCommand)
         , ("Haskell CPP flags", expr $ settingsFileSetting ToolchainSetting_HaskellCPPFlags)
-        , ("ld command", expr $ settingsFileSetting ToolchainSetting_LdCommand)
-        , ("ld flags", expr $ settingsFileSetting ToolchainSetting_LdFlags)
         , ("ld supports compact unwind", expr $ queryTargetTargetConfig linkSupportsCompactUnwind)
         , ("ld supports filelist", expr $ queryTargetTargetConfig linkSupportsFilelist)
         , ("ld supports response files", expr $ queryTargetTargetConfig linkSupportsResponseFiles)


=====================================
m4/fp_prog_ld_filelist.m4
=====================================
@@ -0,0 +1,25 @@
+# FP_PROG_LD_FILELIST
+# -------------------
+# Sets the output variable LdHasFilelist to YES if ld supports
+# -filelist, or NO otherwise.
+AC_DEFUN([FP_PROG_LD_FILELIST],
+[
+AC_CACHE_CHECK([whether ld understands -filelist], [fp_cv_ld_has_filelist],
+[
+    echo 'int foo() { return 0; }' > conftest1.c
+    echo 'int bar() { return 0; }' > conftest2.c
+    ${CC-cc} -c conftest1.c
+    ${CC-cc} -c conftest2.c
+    echo conftest1.o  > conftest.o-files
+    echo conftest2.o >> conftest.o-files
+    if $LD -r -filelist conftest.o-files -o conftest.o > /dev/null 2>&1
+    then
+        fp_cv_ld_has_filelist=yes
+    else
+        fp_cv_ld_has_filelist=no
+    fi
+    rm -rf conftest*
+])
+FP_CAPITALIZE_YES_NO(["$fp_cv_ld_has_filelist"], [LdHasFilelist])
+AC_SUBST([LdHasFilelist])
+])# FP_PROG_LD_FILELIST


=====================================
m4/fp_prog_ld_flag.m4
=====================================
@@ -0,0 +1,17 @@
+# FP_PROG_LD_FLAG
+# ---------------
+# Sets the output variable $2 to $1 if ld supports the $1 flag.
+# Otherwise the variable's value is empty.
+AC_DEFUN([FP_PROG_LD_FLAG],
+[
+AC_CACHE_CHECK([whether ld understands $1], [fp_cv_$2],
+[echo 'int foo() { return 0; }' > conftest.c
+${CC-cc} -c conftest.c
+if $LD -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then
+   fp_cv_$2=$1
+else
+   fp_cv_$2=
+fi
+rm -rf conftest*])
+$2=$fp_cv_$2
+])# FP_PROG_LD_FLAG


=====================================
m4/fp_prog_ld_is_gnu.m4
=====================================
@@ -0,0 +1,13 @@
+# FP_PROG_LD_IS_GNU
+# -----------------
+# Sets the output variable LdIsGNULd to YES or NO, depending on whether it is
+# GNU ld or not.
+AC_DEFUN([FP_PROG_LD_IS_GNU],[
+AC_CACHE_CHECK([whether ld is GNU ld], [fp_cv_gnu_ld],
+[[if $LD --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then
+  fp_cv_gnu_ld=YES
+else
+  fp_cv_gnu_ld=NO
+fi]])
+AC_SUBST([LdIsGNULd],["$fp_cv_gnu_ld"])
+])# FP_PROG_LD_IS_GNU


=====================================
m4/fp_prog_ld_no_compact_unwind.m4
=====================================
@@ -0,0 +1,18 @@
+# FP_PROG_LD_NO_COMPACT_UNWIND
+# ----------------------------
+# Sets the output variable LdHasNoCompactUnwind to YES if ld supports
+# -no_compact_unwind, or NO otherwise.
+AC_DEFUN([FP_PROG_LD_NO_COMPACT_UNWIND],
+[
+AC_CACHE_CHECK([whether ld understands -no_compact_unwind], [fp_cv_ld_no_compact_unwind],
+[echo 'int foo() { return 0; }' > conftest.c
+${CC-cc} -c conftest.c
+if $LD -r -no_compact_unwind -o conftest2.o conftest.o > /dev/null 2>&1; then
+   fp_cv_ld_no_compact_unwind=yes
+else
+   fp_cv_ld_no_compact_unwind=no
+fi
+rm -rf conftest*])
+FP_CAPITALIZE_YES_NO(["$fp_cv_ld_no_compact_unwind"], [LdHasNoCompactUnwind])
+AC_SUBST([LdHasNoCompactUnwind])
+])# FP_PROG_LD_NO_COMPACT_UNWIND


=====================================
m4/fp_settings.m4
=====================================
@@ -19,8 +19,6 @@ AC_DEFUN([FP_SETTINGS],
         SettingsCPPFlags="$CONF_CPP_OPTS_STAGE2 -I\$\$tooldir/mingw/include"
         SettingsHaskellCPPCommand="${mingw_bin_prefix}clang.exe"
         SettingsHaskellCPPFlags="$HaskellCPPArgs -I\$\$tooldir/mingw/include"
-        SettingsLdCommand="${mingw_bin_prefix}ld.lld.exe"
-        SettingsLdFlags=""
         # LLD does not support object merging (#21068)
         SettingsMergeObjectsCommand=""
         SettingsMergeObjectsFlags=""
@@ -43,8 +41,6 @@ AC_DEFUN([FP_SETTINGS],
         SettingsHaskellCPPCommand="$HaskellCPPCmd"
         SettingsHaskellCPPFlags="$HaskellCPPArgs"
         SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
-        SettingsLdCommand="$LdCmd"
-        SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
         SettingsArCommand="$ArCmd"
         SettingsRanlibCommand="$RanlibCmd"
         SettingsMergeObjectsCommand="$MergeObjsCmd"
@@ -120,8 +116,6 @@ AC_DEFUN([FP_SETTINGS],
     AC_SUBST(SettingsCxxCompilerFlags)
     AC_SUBST(SettingsCCompilerLinkFlags)
     AC_SUBST(SettingsCCompilerSupportsNoPie)
-    AC_SUBST(SettingsLdCommand)
-    AC_SUBST(SettingsLdFlags)
     AC_SUBST(SettingsMergeObjectsCommand)
     AC_SUBST(SettingsMergeObjectsFlags)
     AC_SUBST(SettingsArCommand)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b8cba82b5212601f090653c2ec7c3ba20b917cb3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b8cba82b5212601f090653c2ec7c3ba20b917cb3
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/20230529/e0b3a516/attachment-0001.html>


More information about the ghc-commits mailing list