diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 --- 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,12 @@ 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. +For +.Xr ld.lld +16 and later, this is the default. .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 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -264,8 +264,14 @@ # symbols in our version maps that may or may not exist, depending on # compile-time defines. .if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 160000 +.if ${MK_UNDEFINED_VERSION} == "yes" LDFLAGS+= -Wl,--undefined-version .endif +.else +.if ${MK_UNDEFINED_VERSION} == "no" +LDFLAGS+= -Wl,--no-undefined-version +.endif +.endif .endif .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -68,6 +68,7 @@ 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 --- /dev/null +++ b/tools/build/options/WITHOUT_UNDEFINED_VERSION @@ -0,0 +1,5 @@ +Link libraries with --no-undefined-version to ensure all symbols are +provided. +For +.Xr ld.lld +16 and later, this is the default.