summaryrefslogtreecommitdiff
path: root/m4/find_merge_objects.m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-04-02 11:52:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-05 05:42:38 -0400
commit7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch)
tree8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/find_merge_objects.m4
parent6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff)
downloadhaskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz
Break up aclocal.m4
Diffstat (limited to 'm4/find_merge_objects.m4')
-rw-r--r--m4/find_merge_objects.m429
1 files changed, 29 insertions, 0 deletions
diff --git a/m4/find_merge_objects.m4 b/m4/find_merge_objects.m4
new file mode 100644
index 0000000000..fc16e57050
--- /dev/null
+++ b/m4/find_merge_objects.m4
@@ -0,0 +1,29 @@
+# FIND_MERGE_OBJECTS
+# ------------------
+# Find which linker to use to merge object files.
+#
+# See Note [Merging object files for GHCi] in GHC.Driver.Pipeline.
+AC_DEFUN([FIND_MERGE_OBJECTS],[
+ AC_REQUIRE([FIND_LD])
+
+ if test -z "$MergeObjsCmd"; then
+ MergeObjsCmd="$LD"
+ fi
+ if test -z "$MergeObjsArgs"; then
+ MergeObjsArgs="-r"
+ fi
+
+ CHECK_FOR_GOLD_T22266($MergeObjsCmd)
+ if test "$result" = "1"; then
+ AC_MSG_NOTICE([$MergeObjsCmd is broken due to binutils 22266, looking for another linker...])
+ MergeObjsCmd=""
+ AC_CHECK_TARGET_TOOL([MergeObjsCmd], [ld])
+ CHECK_FOR_GOLD_T22266($MergeObjsCmd)
+ if test "$result" = "1"; then
+ AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the MergeObjsCmd variable to a functional linker.])
+ fi
+ fi
+
+ AC_SUBST([MergeObjsCmd])
+ AC_SUBST([MergeObjsArgs])
+])