Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 2024 23:25:18 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 2956f5885cf4 - main - Add an UNDEFINED_VERSION option
Message-ID:  <ZeJj3mEle-mFy0VI@spindle.one-eyed-alien.net>
In-Reply-To: <202403012322.421NMS4W072471@gitrepo.freebsd.org>
References:  <202403012322.421NMS4W072471@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This knob is intended to be temporary to make it easier to fix incorrect
symbol maps.  I've got a set of patches for libc, libgcc_s, and libcxxrt
that I'll submit after further testing.

-- Brooks

On Fri, Mar 01, 2024 at 11:22:28PM +0000, Brooks Davis wrote:
> The branch main has been updated by brooks:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=2956f5885cf4f001bd5c220ee9753d49aa1ad656
> 
> commit 2956f5885cf4f001bd5c220ee9753d49aa1ad656
> Author:     Brooks Davis <brooks@FreeBSD.org>
> AuthorDate: 2024-03-01 23:21:46 +0000
> Commit:     Brooks Davis <brooks@FreeBSD.org>
> CommitDate: 2024-03-01 23:22:11 +0000
> 
>     Add an UNDEFINED_VERSION option
>     
>     When enabled (current default) link with --undefined-version to allow
>     symbol maps to contain symbols not defined by libraries.  When disabled,
>     link with --no-undefined-version to disallow these bugs.
>     
>     WITHOUT_UNDEFINED_VERSION is currently broken.  Once it is fixed it
>     should be made the default and this option should likely be removed.
>     
>     Reviewed by:    dim, emaste
>     Differential Revision:  https://reviews.freebsd.org/D44169
> ---
>  share/man/man5/src.conf.5                     |  5 ++++-
>  share/mk/bsd.lib.mk                           | 10 ++++++----
>  share/mk/bsd.opts.mk                          |  1 +
>  tools/build/options/WITHOUT_UNDEFINED_VERSION |  2 ++
>  4 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
> index 2713e7416a52..255d5a567ec0 100644
> --- a/share/man/man5/src.conf.5
> +++ b/share/man/man5/src.conf.5
> @@ -1,5 +1,5 @@
>  .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
> -.Dd February 17, 2024
> +.Dd March 1, 2024
>  .Dt SRC.CONF 5
>  .Os
>  .Sh NAME
> @@ -1726,6 +1726,9 @@ and that the runtime support library is available
>  Do not build
>  .Xr unbound 8
>  and related programs.
> +.It Va WITHOUT_UNDEFINED_VERSION
> +Link libraries with --no-undefined-version to ensure all symbols are
> +provided.
>  .It Va WITHOUT_UNIFIED_OBJDIR
>  Use the historical object directory format for
>  .Xr build 7
> diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
> index 3cb2f9305e45..981d0b49df39 100644
> --- a/share/mk/bsd.lib.mk
> +++ b/share/mk/bsd.lib.mk
> @@ -260,10 +260,12 @@ SHLIB_NAME_FULL=${SHLIB_NAME}
>  ${SHLIB_NAME_FULL}:	${VERSION_MAP}
>  LDFLAGS+=	-Wl,--version-script=${VERSION_MAP}
>  
> -# lld >= 16 turned on --no-undefined-version by default, but we have several
> -# symbols in our version maps that may or may not exist, depending on
> -# compile-time defines.
> -.if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 160000
> +# Ideally we'd always enable --no-undefined-version (default for lld >= 16),
> +# but we have several symbols in our version maps that may or may not exist,
> +# depending on compile-time defines and that needs to be handled first.
> +.if ${MK_UNDEFINED_VERSION} == "no"
> +LDFLAGS+=	-Wl,--no-undefined-version
> +.else
>  LDFLAGS+=	-Wl,--undefined-version
>  .endif
>  .endif
> diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
> index 51260533e265..dcfe64ac1350 100644
> --- a/share/mk/bsd.opts.mk
> +++ b/share/mk/bsd.opts.mk
> @@ -68,6 +68,7 @@ __DEFAULT_YES_OPTIONS = \
>      SSP \
>      TESTS \
>      TOOLCHAIN \
> +    UNDEFINED_VERSION \
>      WARNS \
>      WERROR
>  
> diff --git a/tools/build/options/WITHOUT_UNDEFINED_VERSION b/tools/build/options/WITHOUT_UNDEFINED_VERSION
> new file mode 100644
> index 000000000000..0e58eb00f3c1
> --- /dev/null
> +++ b/tools/build/options/WITHOUT_UNDEFINED_VERSION
> @@ -0,0 +1,2 @@
> +Link libraries with --no-undefined-version to ensure all symbols are
> +provided.
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZeJj3mEle-mFy0VI>