[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 5 commits: Stop configuring unused Ld command in `settings`

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jun 28 05:44:48 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
d2878c39 by Rodrigo Mesquita at 2023-06-28T01:44:41-04:00
Stop configuring unused Ld command in `settings`

GHC has no direct dependence on the linker. Rather, we depend upon the C
compiler for linking and an object-merging program (which is typically
`ld`) for production of GHCi objects and merging of C stubs into final
object files.

Despite this, for historical reasons we still recorded information about
the linker into `settings`. Remove these entries from `settings`,
`hadrian/cfg/system.config`, as well as the `configure` logic
responsible for this information.

Closes #23566.

- - - - -
4e01a645 by Bryan Richter at 2023-06-28T01:44:42-04:00
Remove extraneous debug output

- - - - -
322846ad by Bryan Richter at 2023-06-28T01:44:42-04:00
Work with unset vars in -e mode

- - - - -
26ec7c6e by Bryan Richter at 2023-06-28T01:44:42-04:00
Pass positional arguments in their positions

By quoting $cmd, the default "bash -i" is a single argument to run, and
no file named "bash -i" actually exists to be run.

- - - - -
05cb2e56 by Bryan Richter at 2023-06-28T01:44:42-04:00
Handle unset value in -e context

- - - - -


15 changed files:

- .gitlab/ci.sh
- .gitlab/darwin/toolchain.nix
- configure.ac
- distrib/configure.ac.in
- 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:

=====================================
.gitlab/ci.sh
=====================================
@@ -211,7 +211,6 @@ function set_toolchain_paths() {
         esac
         info "Building toolchain for $NIX_SYSTEM"
         nix-build --quiet .gitlab/darwin/toolchain.nix --argstr system "$NIX_SYSTEM" -o toolchain.sh
-        cat toolchain.sh
       fi
       source toolchain.sh
       ;;
@@ -219,10 +218,10 @@ function set_toolchain_paths() {
       # These are generally set by the Docker image but
       # we provide these handy fallbacks in case the
       # script isn't run from within a GHC CI docker image.
-      if [ -z "$GHC" ]; then GHC="$(which ghc)"; fi
-      if [ -z "$CABAL" ]; then CABAL="$(which cabal)"; fi
-      if [ -z "$HAPPY" ]; then HAPPY="$(which happy)"; fi
-      if [ -z "$ALEX" ]; then ALEX="$(which alex)"; fi
+      : ${GHC:=$(which ghc)}
+      : ${CABAL:=$(which cabal)}
+      : ${HAPPY:=$(which happy)}
+      : ${ALEX:=$(which alex)}
       ;;
     *) fail "bad toolchain_source"
   esac
@@ -806,7 +805,7 @@ function shell() {
   if [ -z "$cmd" ]; then
     cmd="bash -i"
   fi
-  run "$cmd"
+  run $cmd
 }
 
 function lint_author(){
@@ -915,8 +914,8 @@ determine_metric_baseline
 
 set_toolchain_paths
 
-case $1 in
-  usage) usage ;;
+case ${1:-help} in
+  help|usage) usage ;;
   setup) setup && cleanup_submodules ;;
   configure) time_it "configure" configure ;;
   build_hadrian) time_it "build" build_hadrian ;;


=====================================
.gitlab/darwin/toolchain.nix
=====================================
@@ -113,6 +113,8 @@ pkgs.writeTextFile {
     export CABAL="$CABAL_INSTALL"
 
     sdk_path="$(xcrun --sdk macosx --show-sdk-path)"
-    export CONFIGURE_ARGS="$CONFIGURE_ARGS --with-ffi-libraries=$sdk_path/usr/lib --with-ffi-includes=$sdk_path/usr/include/ffi --build=${targetTriple}"
+    : ''${CONFIGURE_ARGS:=}
+    CONFIGURE_ARGS+="''${CONFIGURE_ARGS:+ }--with-ffi-libraries=$sdk_path/usr/lib --with-ffi-includes=$sdk_path/usr/include/ffi --build=${targetTriple}"
+    export CONFIGURE_ARGS
   '';
 }


=====================================
configure.ac
=====================================
@@ -482,9 +482,7 @@ FIND_LD([$target],[GccUseLdOpt])
 FIND_MERGE_OBJECTS()
 CONF_GCC_LINKER_OPTS_STAGE1="$CONF_GCC_LINKER_OPTS_STAGE1 $GccUseLdOpt"
 CONF_GCC_LINKER_OPTS_STAGE2="$CONF_GCC_LINKER_OPTS_STAGE2 $GccUseLdOpt"
-LdCmd="$LD"
 CFLAGS="$CFLAGS $GccUseLdOpt"
-AC_SUBST([LdCmd])
 
 FP_PROG_LD_IS_GNU
 FP_PROG_LD_NO_COMPACT_UNWIND
@@ -1246,7 +1244,6 @@ echo "\
    hs-cpp       : $HaskellCPPCmd
    hs-cpp-flags : $HaskellCPPArgs
    ar           : $ArCmd
-   ld           : $LdCmd
    nm           : $NmCmd
    objdump      : $ObjdumpCmd
    ranlib       : $RanlibCmd


=====================================
distrib/configure.ac.in
=====================================
@@ -125,9 +125,7 @@ FIND_LD([$target],[GccUseLdOpt])
 FIND_MERGE_OBJECTS()
 CONF_GCC_LINKER_OPTS_STAGE1="$CONF_GCC_LINKER_OPTS_STAGE1 $GccUseLdOpt"
 CONF_GCC_LINKER_OPTS_STAGE2="$CONF_GCC_LINKER_OPTS_STAGE2 $GccUseLdOpt"
-LdCmd="$LD"
 CFLAGS="$CFLAGS $GccUseLdOpt"
-AC_SUBST([LdCmd])
 
 FP_PROG_LD_IS_GNU
 FP_PROG_LD_NO_COMPACT_UNWIND


=====================================
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
=====================================
@@ -87,8 +87,6 @@ lib/settings : config.mk
 	@echo ',("C compiler supports -no-pie", "$(SettingsCCompilerSupportsNoPie)")' >> $@
 	@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
=====================================
@@ -263,8 +263,6 @@ SettingsCCompilerFlags = @SettingsCCompilerFlags@
 SettingsCxxCompilerFlags = @SettingsCxxCompilerFlags@
 SettingsCCompilerLinkFlags = @SettingsCCompilerLinkFlags@
 SettingsCCompilerSupportsNoPie = @SettingsCCompilerSupportsNoPie@
-SettingsLdCommand = @SettingsLdCommand@
-SettingsLdFlags = @SettingsLdFlags@
 SettingsMergeObjectsCommand = @SettingsMergeObjectsCommand@
 SettingsMergeObjectsFlags = @SettingsMergeObjectsFlags@
 SettingsArCommand = @SettingsArCommand@


=====================================
hadrian/cfg/system.config.in
=====================================
@@ -11,7 +11,7 @@ autoreconf     = @AutoreconfCmd@
 cc             = @CC@
 happy          = @HappyCmd@
 hs-cpp         = @HaskellCPPCmd@
-ld             = @LdCmd@
+ld             = @LD@
 make           = @MakeCmd@
 nm             = @NmCmd@
 merge-objects  = @MergeObjsCmd@
@@ -151,8 +151,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
=====================================
@@ -115,8 +115,6 @@ data SettingsFileSetting
     | SettingsFileSetting_CxxCompilerFlags
     | SettingsFileSetting_CCompilerLinkFlags
     | SettingsFileSetting_CCompilerSupportsNoPie
-    | SettingsFileSetting_LdCommand
-    | SettingsFileSetting_LdFlags
     | SettingsFileSetting_MergeObjectsCommand
     | SettingsFileSetting_MergeObjectsFlags
     | SettingsFileSetting_ArCommand
@@ -214,8 +212,6 @@ settingsFileSetting key = lookupSystemConfig $ case key of
     SettingsFileSetting_CxxCompilerFlags -> "settings-cxx-compiler-flags"
     SettingsFileSetting_CCompilerLinkFlags -> "settings-c-compiler-link-flags"
     SettingsFileSetting_CCompilerSupportsNoPie -> "settings-c-compiler-supports-no-pie"
-    SettingsFileSetting_LdCommand -> "settings-ld-command"
-    SettingsFileSetting_LdFlags -> "settings-ld-flags"
     SettingsFileSetting_MergeObjectsCommand -> "settings-merge-objects-command"
     SettingsFileSetting_MergeObjectsFlags -> "settings-merge-objects-flags"
     SettingsFileSetting_ArCommand -> "settings-ar-command"


=====================================
hadrian/src/Rules/Generate.hs
=====================================
@@ -446,8 +446,6 @@ generateSettings = do
         , ("C compiler supports -no-pie", expr $ settingsFileSetting SettingsFileSetting_CCompilerSupportsNoPie)
         , ("Haskell CPP command", expr $ settingsFileSetting SettingsFileSetting_HaskellCPPCommand)
         , ("Haskell CPP flags", expr $ settingsFileSetting SettingsFileSetting_HaskellCPPFlags)
-        , ("ld command", expr $ settingsFileSetting SettingsFileSetting_LdCommand)
-        , ("ld flags", expr $ settingsFileSetting SettingsFileSetting_LdFlags)
         , ("ld supports compact unwind", expr $ lookupSystemConfig "ld-has-no-compact-unwind")
         , ("ld supports filelist", expr $ lookupSystemConfig "ld-has-filelist")
         , ("ld supports response files", expr $ lookupSystemConfig "ld-supports-response-files")


=====================================
m4/fp_prog_ld_filelist.m4
=====================================
@@ -12,7 +12,7 @@ AC_CACHE_CHECK([whether ld understands -filelist], [fp_cv_ld_has_filelist],
     ${CC-cc} -c conftest2.c
     echo conftest1.o  > conftest.o-files
     echo conftest2.o >> conftest.o-files
-    if ${LdCmd} -r -filelist conftest.o-files -o conftest.o > /dev/null 2>&1
+    if $LD -r -filelist conftest.o-files -o conftest.o > /dev/null 2>&1
     then
         fp_cv_ld_has_filelist=yes
     else


=====================================
m4/fp_prog_ld_flag.m4
=====================================
@@ -7,7 +7,7 @@ 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 ${LdCmd} -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then
+if $LD -r $1 -o conftest2.o conftest.o > /dev/null 2>&1; then
    fp_cv_$2=$1
 else
    fp_cv_$2=


=====================================
m4/fp_prog_ld_is_gnu.m4
=====================================
@@ -4,7 +4,7 @@
 # GNU ld or not.
 AC_DEFUN([FP_PROG_LD_IS_GNU],[
 AC_CACHE_CHECK([whether ld is GNU ld], [fp_cv_gnu_ld],
-[[if ${LdCmd} --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then
+[[if $LD --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then
   fp_cv_gnu_ld=YES
 else
   fp_cv_gnu_ld=NO


=====================================
m4/fp_prog_ld_no_compact_unwind.m4
=====================================
@@ -7,7 +7,7 @@ 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 ${LdCmd} -r -no_compact_unwind -o conftest2.o conftest.o > /dev/null 2>&1; then
+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


=====================================
m4/fp_settings.m4
=====================================
@@ -16,8 +16,6 @@ AC_DEFUN([FP_SETTINGS],
         SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2 -L\$\$tooldir/mingw/lib -L\$\$tooldir/mingw/x86_64-w64-mingw32/lib"
         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=""
@@ -38,8 +36,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"
@@ -113,8 +109,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/-/compare/800c1fe5549335097cd77797e716e99cacce08b4...05cb2e565d33919a3f0af371011ff90805be8e8b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/800c1fe5549335097cd77797e716e99cacce08b4...05cb2e565d33919a3f0af371011ff90805be8e8b
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/20230628/f30e6c3b/attachment-0001.html>


More information about the ghc-commits mailing list