Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Apr 2021 16:44:45 +0200
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        "Shawn Webb" <shawn.webb@hardenedbsd.org>
Cc:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 0dd13c77432a - main - libnv: Build PIC
Message-ID:  <508CFCEE-2639-451E-B98C-42DD3DC1B4D7@FreeBSD.org>
In-Reply-To: <20210412144010.lcv7swa5ob3eql6m@mutt-hbsd>
References:  <202104100916.13A9GMOp069019@gitrepo.freebsd.org> <20210410152754.4isx26qyvz6k3qbo@mutt-hbsd> <98C59789-AF1F-4B88-B814-F0BD359A06BD@FreeBSD.org> <20210412144010.lcv7swa5ob3eql6m@mutt-hbsd>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12 Apr 2021, at 16:40, Shawn Webb wrote:
> On Mon, Apr 12, 2021 at 01:39:50PM +0200, Kristof Provost wrote:
>> On 10 Apr 2021, at 17:27, Shawn Webb wrote:
>>> On Sat, Apr 10, 2021 at 09:16:22AM +0000, Kristof Provost wrote:
>>>> The branch main has been updated by kp:
>>>>
>>>> URL: =

>>>> https://cgit.FreeBSD.org/src/commit/?id=3D0dd13c77432ade1ae94c9661cb=
ad5537e3e6ab1d
>>>>
>>>> commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d
>>>> Author:     Kristof Provost <kp@FreeBSD.org>
>>>> AuthorDate: 2021-04-02 15:06:02 +0000
>>>> Commit:     Kristof Provost <kp@FreeBSD.org>
>>>> CommitDate: 2021-04-10 09:16:01 +0000
>>>>
>>>>     libnv: Build PIC
>>>>
>>>>     Build libnv as position independent code so we can use it from
>>>> shared
>>>>     libraries.
>>>>
>>>>     MFC after:      4 weeks
>>>>     Sponsored by:   Rubicon Communications, LLC ("Netgate")
>>>>     Differential Revision:  https://reviews.freebsd.org/D29561
>>>> ---
>>>>  lib/libnv/Makefile | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile
>>>> index b13758931c4e..854cd2c7f3f3 100644
>>>> --- a/lib/libnv/Makefile
>>>> +++ b/lib/libnv/Makefile
>>>> @@ -10,6 +10,7 @@ SHLIB_MAJOR=3D 0
>>>>
>>>>  .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys
>>>>  CFLAGS+=3D-I${.CURDIR}
>>>> +CFLAGS+=3D-fPIC
>>>
>>> Wouldn't the better fix be renaming LIB to SHLIB like every other =

>>> PIC
>>> lib?
>>>
>> Ed pointed me at INSTALL_PIC_ARCHIVE. I=E2=80=99m also pondering just =

>> making
>> libpfctl a .so, which should also fix the issue this addresses.
>>
>> The complication is that libpfctl is currently a .a, and can be used =

>> in a
>> shared library itself (for bsnmp), so it has to be - and use - PIC.
>
> Out of curiosity, is there a reason not to have the shared library
> depend on libnv as a shared library?
>
That=E2=80=99s mostly an accident. Libpfctl is currently marked as =

INTERNALLIB=3Dtrue, which makes it a static library and links it to the =

static library.

I=E2=80=99m considering making libpfctl a shared library, if only because=
 =

there are consumers of the pf ioctl interface in ports, and I intend to =

remove some of the old (for which there are now nvlist-based versions) =

ioctls. That will be a lot easier for those applications if they can =

just use libpfctl.
The downside is that, if we consider libpfctl to be a stable ABI, we =

move the previous ABI problem from the kernel to userspace, rather than =

getting rid of it.

Best regards,
Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?508CFCEE-2639-451E-B98C-42DD3DC1B4D7>