summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorKarel Gardas <karel.gardas@centrum.cz>2020-10-04 23:11:33 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-07 15:02:48 -0400
commit030c5ce0a58e212eb7b973e1206b775085b74afb (patch)
tree61dd78f8dc847b222ec153bce6eb9404e3221ea8 /hadrian
parentd6dff830754a97220eacf032c32cd54b18654917 (diff)
downloadhaskell-030c5ce0a58e212eb7b973e1206b775085b74afb.tar.gz
hadrian: use stage0 linker to merge objects when done during the stage0
Fixes #18800.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/cfg/system.config.in1
-rw-r--r--hadrian/src/Builder.hs9
2 files changed, 10 insertions, 0 deletions
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
index 1297a2c1cc..8a3fb9341f 100644
--- a/hadrian/cfg/system.config.in
+++ b/hadrian/cfg/system.config.in
@@ -15,6 +15,7 @@ ld = @LdCmd@
make = @MakeCmd@
nm = @NmCmd@
merge-objects = @MergeObjsCmd@
+system-merge-objects = @LD_STAGE0@
objdump = @ObjdumpCmd@
ranlib = @REAL_RANLIB_CMD@
sphinx-build = @SPHINXBUILD@
diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index 743d169644..5d7ff33720 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -317,6 +317,15 @@ systemBuilderPath builder = case builder of
Happy -> fromKey "happy"
HsCpp -> fromKey "hs-cpp"
Ld _ -> fromKey "ld"
+ -- MergeObjects Stage0 is a special case in case of
+ -- cross-compiling. We're building stage1, e.g. code which will be
+ -- executed on the host and hence we need to use host's merge
+ -- objects tool and not the target merge object tool.
+ -- Note, merge object tool is usually platform linker with some
+ -- parameters. E.g. building a cross-compiler on and for x86_64
+ -- which will target ppc64 means that MergeObjects Stage0 will use
+ -- x86_64 linker and MergeObject _ will use ppc64 linker.
+ MergeObjects Stage0 -> fromKey "system-merge-objects"
MergeObjects _ -> fromKey "merge-objects"
Make _ -> fromKey "make"
Makeinfo -> fromKey "makeinfo"