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

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Thu, 21 Jul 2022 17:23:34 UTC
On Thu, Jul 21, 2022 at 04:36:46PM +0000, Kristof Provost 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
> --- /dev/null
> +++ b/lib/libnv/Version.map
> @@ -0,0 +1,256 @@
> +# $FreeBSD$
> +
> +FBSD_1.0 {
This should be FBSD_1.7, the current HEAD FreeBSD namespace.

And as Kyle pointed out, the dso version needs to be bumped because
you changed dso ABI.