nss: Remove --enable-static-nss configure option

Since the NSS reorganization in glibc 2.33 the --enable-static-nss
option no longer changes the build: the files and dns services are built
into libc unconditionally, and there is no longer any mechanism to bake
the remaining services into libc.a.  After removing the dead
-DSTATIC_NSS define and the <gnu/lib-names.h> include (commits
82b710c190 and
2169401438), the option's only remaining
effect was to define DO_STATIC_NSS, which suppresses the static link
warnings on the NSS interface functions in libc.a.

With DO_STATIC_NSS gone, nss_interface_function emits the static link
warning unconditionally; static_nss and build-static-nss are removed
along with the configure option.

tst-nss-static, previously built only when build-static-nss was set, is
now added to tests-static unconditionally so the static NSS path retains
test coverage.

Signed-off-by: Michael Ford <fanquake@gmail.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Michael Ford
2026-06-25 10:20:24 -03:00
committed by Adhemerval Zanella
parent 657fe73fb1
commit ead80441e6
9 changed files with 10 additions and 59 deletions
-6
View File
@@ -158,12 +158,6 @@ passed to 'configure'. For example:
Don't build libraries with profiling information. You may want to
use this option if you don't plan to do profiling.
'--enable-static-nss'
Compile static versions of the NSS (Name Service Switch) libraries.
This is not recommended because it defeats the purpose of NSS; a
program linked statically with the NSS libraries cannot be
dynamically reconfigured to use a different name database.
'--enable-hardcoded-path-in-tests'
By default, dynamic tests are linked to run with the installed C
library. This option hardcodes the newly built C library path in
+5
View File
@@ -43,6 +43,11 @@ Deprecated and removed features, and other changes affecting compatibility:
The corresponding AArch64-specific functionality that was previously
activated by this flag has been removed as well.
* The --enable-static-nss configure option has been removed. It had no
effect on the build since the NSS reorganization in glibc 2.33; its only
remaining behavior was to suppress the link-time warnings on the NSS
interface functions in libc.a, which are now emitted unconditionally.
Changes to build and runtime requirements:
[Add changes to build and runtime requirements here]
-3
View File
@@ -32,9 +32,6 @@
/* Define if _Unwind_Find_FDE should be exported from glibc. */
#undef EXPORT_UNWIND_FIND_FDE
/* Define if static NSS modules are wanted. */
#undef DO_STATIC_NSS
/* Assume that the compiler supports __builtin_expect.
This macro is necessary for proper compilation of code
shared between GNU libc and GNU gettext projects. */
-1
View File
@@ -81,7 +81,6 @@ mach-interface-list = @mach_interface_list@
# Configuration options.
build-shared = @shared@
build-profile = @profile@
build-static-nss = @static_nss@
cross-compiling = @cross_compiling@
force-install = @force_install@
build-nscd = @build_nscd@
Vendored
-19
View File
@@ -616,7 +616,6 @@ RELEASE
VERSION
mach_interface_list
DEFINES
static_nss
profile
libc_cv_multidir
test_enable_cet
@@ -804,7 +803,6 @@ enable_hardcoded_path_in_tests
enable_hidden_plt
enable_bind_now
enable_stack_protector
enable_static_nss
enable_force_install
enable_maintainer_mode
enable_kernel
@@ -1477,7 +1475,6 @@ Optional Features:
--enable-stack-protector=[yes|no|all|strong]
Use -fstack-protector[-all|-strong] to detect glibc
buffer overflows
--enable-static-nss build static NSS modules [default=no]
--disable-force-install don't force installation of files from this package,
even if they are older than the installed files
--enable-maintainer-mode
@@ -4614,21 +4611,6 @@ all|yes|no|strong) ;;
*) as_fn_error $? "Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"" "$LINENO" 5;;
esac
# Check whether --enable-static-nss was given.
if test ${enable_static_nss+y}
then :
enableval=$enable_static_nss; static_nss=$enableval
else case e in #(
e) static_nss=no ;;
esac
fi
if test x"$static_nss" = xyes || test x"$shared" = xno; then
static_nss=yes
printf "%s\n" "#define DO_STATIC_NSS 1" >>confdefs.h
fi
# Check whether --enable-force-install was given.
if test ${enable_force_install+y}
then :
@@ -9595,7 +9577,6 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
-14
View File
@@ -272,19 +272,6 @@ all|yes|no|strong) ;;
*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: "$enable_stack_protector"]);;
esac
dnl On some platforms we cannot use dynamic loading. We must provide
dnl static NSS modules.
AC_ARG_ENABLE([static-nss],
AS_HELP_STRING([--enable-static-nss],
[build static NSS modules @<:@default=no@:>@]),
[static_nss=$enableval],
[static_nss=no])
dnl Enable static NSS also if we build no shared objects.
if test x"$static_nss" = xyes || test x"$shared" = xno; then
static_nss=yes
AC_DEFINE(DO_STATIC_NSS)
fi
AC_ARG_ENABLE([force-install],
AS_HELP_STRING([--disable-force-install],
[don't force installation of files from this package, even if they are older than the installed files]),
@@ -2200,7 +2187,6 @@ libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
AC_SUBST(libc_cv_multidir)
AC_SUBST(profile)
AC_SUBST(static_nss)
AC_SUBST(DEFINES)
-6
View File
@@ -189,12 +189,6 @@ NOTE: @option{--enable-cet} is only supported on x86_64 and x32.
Don't build libraries with profiling information. You may want to use
this option if you don't plan to do profiling.
@item --enable-static-nss
Compile static versions of the NSS (Name Service Switch) libraries.
This is not recommended because it defeats the purpose of NSS; a program
linked statically with the NSS libraries cannot be dynamically
reconfigured to use a different name database.
@item --enable-hardcoded-path-in-tests
By default, dynamic tests are linked to run with the installed C library.
This option hardcodes the newly built C library path in dynamic tests
-3
View File
@@ -427,12 +427,9 @@ libnss_compat-routines := $(addprefix compat-,grp pwd spwd initgroups) \
install-others += $(inst_vardbdir)/Makefile
# Build static module into libc if requested
libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
libnss_compat-inhibit-o = $(filter-out .os,$(object-suffixes))
ifeq ($(build-static-nss),yes)
tests-static += tst-nss-static
endif
extra-test-objs += nss_test1.os nss_test2.os nss_test_errno.os \
nss_test_gai_hv2_canonname.os
+5 -7
View File
@@ -77,13 +77,11 @@ enum
extern bool __nss_database_custom[NSS_DBSIDX_max] attribute_hidden;
#endif
/* Warning for NSS functions, which don't require dlopen if glibc
was built with --enable-static-nss. */
#ifdef DO_STATIC_NSS
# define nss_interface_function(name)
#else
# define nss_interface_function(name) static_link_warning (name)
#endif
/* NSS lookups can load service modules via dlopen at runtime, so a
statically linked program still depends on the shared NSS modules
matching the libc it was built against. Emit the static link
warning on the NSS interface functions accordingly. */
#define nss_interface_function(name) static_link_warning (name)
/* Interface functions for NSS. */