]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nss: Remove --enable-static-nss configure option
authorMichael Ford <fanquake@gmail.com>
Thu, 25 Jun 2026 09:21:16 +0000 (10:21 +0100)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 25 Jun 2026 13:20:24 +0000 (10:20 -0300)
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
82b710c1900944ea122a3880f542215948fc023d and
21694014388ad278aa03241800d1f0c0a7127ad1), 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>
INSTALL
NEWS
config.h.in
config.make.in
configure
configure.ac
manual/install.texi
nss/Makefile
nss/nsswitch.h

diff --git a/INSTALL b/INSTALL
index b67da640bde53168e0b983f524ae71617f71b01e..cd4b6e5c2f9ac2456f42ca60bc4f86c18074839b 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -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
diff --git a/NEWS b/NEWS
index 6190ac43d8f0349183a99ac9caee13b33bd8dd6d..41b59da04b3d2f3a91e200fda9a03505664242d7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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]
index 40854de9937c541c7e96726e4a0ebb582efa71b5..17bdd3057087656b74940f52fd0563dae9c69b62 100644 (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.  */
index 12ccb55e534fc7394a006af341cc38a3e7b5a17b..0ddc24a5899103e268a35db97eed850b33c6850e 100644 (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@
index 90c4b4f858adc021d4185866a5847be0f6f88d0a..604279533a1eb89fa05324fab59cdb45d2a51cbc 100755 (executable)
--- a/configure
+++ b/configure
@@ -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`
 
index 2a788c13b7d0de8351c6cad4278b872dd0a694c0..2fe7980fc9c2b7282d9c976a0dd5aba03412470e 100644 (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)
 
index 4094baa259901207cfb61253aa98ee9cd0f56f33..48604a31dfb19e6556c0cb30b9c17ac0ed1762f1 100644 (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
index 54389ced0ee53bc3f631f10450b190407a46ef18..b1f25f0d719b545b4e6c94022d99bc13871c3957 100644 (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
 
index 1b18794feeed6d8abc17b7dda0f137e41e01a0f0..e3191df10d0737b64030e0301fb2ed14c94303e4 100644 (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.  */