Re: 5e4854cbf8d8 - main - rescue: Link libzutil after libzfs.

From: Ravi Pokala <rpokala_at_freebsd.org>
Date: Tue, 04 Oct 2022 03:03:36 UTC
-----Original Message-----
From: <owner-src-committers@freebsd.org> on behalf of John Baldwin <jhb@FreeBSD.org>
Date: 2022-10-03, Monday at 16:11
To: <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>, <dev-commits-src-main@FreeBSD.org>
Subject: git: 5e4854cbf8d8 - main - rescue: Link libzutil after libzfs.

    The branch main has been updated by jhb:

    URL: https://cgit.FreeBSD.org/src/commit/?id=5e4854cbf8d8a9b056472967d15e1021d36fcae1

    commit 5e4854cbf8d8a9b056472967d15e1021d36fcae1
    Author:     John Baldwin <jhb@FreeBSD.org>
    AuthorDate: 2022-10-03 23:10:42 +0000
    Commit:     John Baldwin <jhb@FreeBSD.org>
    CommitDate: 2022-10-03 23:10:42 +0000

        rescue: Link libzutil after libzfs.

        libzfs depends on symbols defined in libzutil.  For static linking
        ld.bfd is less forgiving than lld, so rescue was failing to link when
        using ld.bfd due to unresolved symbols from libzutil used by libzfs.

You're solving an issue of unresolved symbols by putting the library where they're defined *after* the library where they're used?

-Ravi (rpokala@)

        Reviewed by:    imp, kib, emaste
        Differential Revision:  https://reviews.freebsd.org/D36811
    ---
     rescue/rescue/Makefile | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile
    index 3c758a41f294..cc4c13c0a624 100644
    --- a/rescue/rescue/Makefile
    +++ b/rescue/rescue/Makefile
    @@ -140,8 +140,8 @@ CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
     CRUNCH_LIBS+= -lavl -lpthread -luutil -lumem -ltpool -lspl
     CRUNCH_LIBS_zfs+=	${LIBBE} \
     			${LIBZPOOL} \
    -			${LIBZUTIL} \
     			${LIBZFS} \
    +			${LIBZUTIL} \
     			${LIBZFS_CORE} \
     			${LIBZFSBOOTENV} \
     			${LIBICP_RESCUE} \