bindist's configure generates an invalid target file
Summary
The configure in the bindist script generates an invalid target description file (unlike ghc-toolchain). This is currently not a problem for the usability of the compiler because the settings
file (also written by configure with roughly the same information) is used directly, but in a future where the target description files are used by GHC instead of the settings
file (#24212) it will be.
The whole point of generating these files in the bindists is to diff them against the ones generated by ghc-toolchain to find discrepancies between the two. At the moment, this is a completely useless check because the target generated by configure is very broken...
Steps to reproduce
Download a binary distribution of GHC 9.10.1 and run
./configure && cat default.target
You should get something like
Target
{ tgtArchOs = ArchOS {archOS_arch = ArchX86_64, archOS_OS = OSLinux}
, tgtVendor =
, tgtLocallyExecutable =
, tgtSupportsGnuNonexecStack =
, tgtSupportsSubsectionsViaSymbols =
, tgtSupportsIdentDirective =
, tgtWordSize = WS8
, tgtEndianness =
, tgtSymbolsHaveLeadingUnderscore =
, tgtLlvmTarget = "@LlvmTarget@"
, tgtUnregisterised =
, tgtTablesNextToCode =
, tgtUseLibffiForAdjustors =
, tgtCCompiler = Cc {ccProgram = Program {prgPath = "gcc", prgFlags = }}
, tgtCxxCompiler = Cxx {cxxProgram = Program {prgPath = "g++", prgFlags = }}
, tgtCPreprocessor = Cpp {cppProgram = Program {prgPath = "gcc", prgFlags = }}
, tgtHsCPreprocessor = HsCpp {hsCppProgram = Program {prgPath = "gcc", prgFlags = }}
, tgtCCompilerLink = CcLink
{ ccLinkProgram = Program {prgPath = "gcc", prgFlags = }
, ccLinkSupportsNoPie =
, ccLinkSupportsCompactUnwind =
, ccLinkSupportsFilelist =
, ccLinkSupportsSingleModule =
, ccLinkIsGnu =
}
, tgtAr = Ar
{ arMkArchive = Program {prgPath = "ar", prgFlags = }
, arIsGnu =
, arSupportsAtFile =
, arSupportsDashL =
, arNeedsRanlib =
}
, tgtRanlib = Just (Ranlib {ranlibProgram = Program {prgPath = "ranlib", prgFlags = []}})
, tgtNm = Nm {nmProgram = Program {prgPath = "nm", prgFlags = []}}
, tgtMergeObjs =
, tgtWindres =
}
Expected behavior
Note how half the fields are empty and tgtLlvmTarget
still refers to a macro...
Ghc-toolchain generates the following file:
Target
{ tgtArchOs = ArchOS {archOS_arch = ArchAArch64, archOS_OS = OSDarwin}
, tgtVendor = Just "apple"
, tgtLocallyExecutable = True
, tgtSupportsGnuNonexecStack = False
, tgtSupportsSubsectionsViaSymbols = False
, tgtSupportsIdentDirective = True
, tgtWordSize = WS8
, tgtEndianness = LittleEndian
, tgtSymbolsHaveLeadingUnderscore = True
, tgtLlvmTarget = "arm64-apple-darwin"
, tgtUnregisterised = False
, tgtTablesNextToCode = True
, tgtUseLibffiForAdjustors = True
, tgtCCompiler = Cc {ccProgram = Program { prgPath = "/usr/bin/gcc" , prgFlags = ["--target=arm64-apple-darwin","-Qunused-arguments"] }}
, tgtCxxCompiler = Cxx {cxxProgram = Program { prgPath = "/usr/bin/g++" , prgFlags = ["--target=arm64-apple-darwin"] }}
, tgtCPreprocessor = Cpp {cppProgram = Program { prgPath = "/usr/bin/gcc" , prgFlags = ["-E"] }}
, tgtHsCPreprocessor = HsCpp {hsCppProgram = Program { prgPath = "/usr/bin/gcc" , prgFlags = ["-E","-undef","-traditional","-Wno-invalid-pp-token","-Wno-unicode","-Wno-trigraphs"] }}
, tgtCCompilerLink = CcLink
{ ccLinkProgram = Program { prgPath = "/usr/bin/gcc" , prgFlags = ["--target=arm64-apple-darwin","-Wl,-no_fixup_chains","-Wl,-no_warn_duplicate_libraries"] }
, ccLinkSupportsNoPie = False
, ccLinkSupportsCompactUnwind = True
, ccLinkSupportsFilelist = True
, ccLinkSupportsSingleModule = False
, ccLinkIsGnu = False
}
, tgtAr = Ar
{ arMkArchive = Program { prgPath = "/usr/bin/ar" , prgFlags = ["qcls"] }
, arIsGnu = False
, arSupportsAtFile = False
, arSupportsDashL = False
, arNeedsRanlib = True
}
, tgtRanlib = Just (Ranlib {ranlibProgram = Program { prgPath = "/usr/bin/ranlib" , prgFlags = [] }})
, tgtNm = Nm {nmProgram = Program { prgPath = "/usr/bin/nm" , prgFlags = [] }}
, tgtMergeObjs = Just (MergeObjs {mergeObjsProgram = Program { prgPath = "/usr/bin/ld" , prgFlags = ["-r"] }, mergeObjsSupportsResponseFiles = True})
, tgtWindres = Nothing
}