summaryrefslogtreecommitdiff
path: root/m4/find_merge_objects.m4
blob: fc16e570507c844e18168027b96861ec66e53b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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])
])