[Git][ghc/ghc][wip/romes/drop-ld] Stop configuring unused Ld command in `settings`
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Tue Jun 27 15:45:33 UTC 2023
Ben Gamari pushed to branch wip/romes/drop-ld at Glasgow Haskell Compiler / GHC
Commits:
4120a0ea by Rodrigo Mesquita at 2023-06-27T11:45:19-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.
- - - - -
13 changed files:
- 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:
=====================================
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_BUILD_ID
@@ -1247,7 +1245,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_BUILD_ID
=====================================
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/-/commit/4120a0eabe2de91c7b84080daa625b5b5bfb0a0e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4120a0eabe2de91c7b84080daa625b5b5bfb0a0e
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/20230627/d57e6f1d/attachment-0001.html>
More information about the ghc-commits
mailing list