Skip to content

hadrian: Fix linker script flag for MergeObjects builder

!9530 (closed) added a linker script that is passed to ld by the MergeObjects builder, which is used for merging objects for GHCi (see Note [Merging object files for GHCi] in GHC.Driver.Pipeline.Execute). However, the patch uses the -t flag for this purpose, which seems to be incorrect: on all ld implementations I’ve looked at (including BSD ld, GNU ld, GNU gold, and LLVM lld), -t just enables a tracing mode, while -T specifies a linker script.

It’s not immediately clear to me why this worked at all, but it seems like maybe some implementations of ld autodetect linker script arguments, in which case the use of -t would be innocuous, and things would work out okay. But gold outright barfs without the use of -T:

ld.gold: error: driver/utils/merge_sections.ld: SECTIONS seen after other input files; try -T/--script

This MR changes Hadrian to pass -T instead of -t, which appears to resolve the issue.

Merge request reports