Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Oct 2022 09:33:11 -0700
From:      John Baldwin <jhb@FreeBSD.org>
To:        Ravi Pokala <rpokala@freebsd.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: 5e4854cbf8d8 - main - rescue: Link libzutil after libzfs.
Message-ID:  <a0b5ba32-aae4-3f0f-e2a1-ad941752c2a7@FreeBSD.org>
In-Reply-To: <1BB1F50E-C679-4570-8C7C-582B8C83CAD6@panasas.com>
References:  <202210032311.293NBKEd065568@gitrepo.freebsd.org> <1BB1F50E-C679-4570-8C7C-582B8C83CAD6@panasas.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/3/22 8:03 PM, Ravi Pokala wrote:
> -----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@)

Yes, that's normally how that works (you link libc last, not first).  lld is just
a bit different as it will look in earlier libraries to resolve symbols (backwards
references) not just forward references.  ld.bfd only does forward references by
default.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a0b5ba32-aae4-3f0f-e2a1-ad941752c2a7>