Re: git: 000321bab7be - main - namespace nv names, version libnv and libnvpair library symbols

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 21 Jul 2022 18:12:30 UTC
On 21 Jul 2022, at 11:04, Kyle Evans wrote:
> On Thu, Jul 21, 2022 at 9:36 AM Kristof Provost <kp@freebsd.org> wrote:
>>
>> The branch main has been updated by kp:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=000321bab7bea3530408b960095a6ea241451175
>>
>> commit 000321bab7bea3530408b960095a6ea241451175
>> Author:     Reid Linnemann <rlinnemann@netgate.com>
>> AuthorDate: 2022-05-17 19:49:41 +0000
>> Commit:     Kristof Provost <kp@FreeBSD.org>
>> CommitDate: 2022-07-21 16:35:23 +0000
>>
>>     namespace nv names, version libnv and libnvpair library symbols
>>
>>     libnv and libnvpair have aliased symbols, and as a result a single process which
>>     dlopens a shared object that is dynamically linked to libnv and another to
>>     libnvpair will wind up with a single set of resolved symbols for those in
>>     conflict. A source file also cannot include both libnv and libnvpair headers
>>     because of aliased identifiers. To resolve the situation, libnv types and
>>     functions are namespaced via nv_namespace.h, and libnv symbols are
>>     versioned. The msgio functions are not namespaced or exported as they are not
>>     part of the external API.
>>
>>     Reviewed by:    kevans
>>     Sponsored by:   Rubicon Communications, LLC ("Netgate")
>>     Differential Revision: https://reviews.freebsd.org/D35261
>> ---
>>  lib/libnv/Makefile     |   3 +
>>  lib/libnv/Version.map  | 256 +++++++++++++++++++++++++++++++++++++++++++
>>  sys/sys/cnv.h          |   1 +
>>  sys/sys/dnv.h          |   1 +
>>  sys/sys/nv.h           |   1 +
>>  sys/sys/nv_namespace.h | 286 +++++++++++++++++++++++++++++++++++++++++++++++++
>>  tools/build/Makefile   |   2 +-
>>  7 files changed, 549 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile
>> index b13758931c4e..933dacb3eac6 100644
>> --- a/lib/libnv/Makefile
>> +++ b/lib/libnv/Makefile
>> @@ -8,6 +8,9 @@ PACKAGE=        runtime
>>  LIB=   nv
>>  SHLIB_MAJOR= 0
>>
>> +VERSION_DEF=   ${SRCTOP}/lib/libc/Versions.def
>> +VERSION_MAP=   ${.CURDIR}/Version.map
>> +
>>  .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys
>>  CFLAGS+=-I${.CURDIR}
>>
>> diff --git a/lib/libnv/Version.map b/lib/libnv/Version.map
>> new file mode 100644
>> index 000000000000..98349c2356d3
>
> IIRC this still needed the SHLIB_MAJOR bump (+ObsoleteFiles.inc for
> the old version) that I had talked about because we're adding a symbol
> map, but maybe someone else can clarify that.
>
I missed that comment in the review. Something like this then: https://reviews.freebsd.org/D35875 ?

(I fixed the other remarks in the same commit.)

Kristof