[PATCH] configure: Add --disable-libsupport option

Florian Weimer fweimer@redhat.com
Tue Mar 25 11:39:38 GMT 2025


This option allows to build (but not test) glibc with a GCC that
was built with --enable-shared, but which does not have access
to its libgcc_s.so.1 DSO.  In this scenario, the -lgcc_s test
added in commit 5dfbc3c43ecc1bcfc760a032c91bb002660051bc ("support:
Link links-dso-program-c with libgcc_s only if available") fails
and linking against -lgcc_s is skipped.  However, the test program
still has a dependency on _Unwind_Resume, but for a GCC built
with --enable-shared, this symbol is not available with -lgcc.

Fixes commit 3e2be87832781a29ed67f38f87c1ce3dd4c1b866 ("support: Link
links-dso-program-c against libgcc_s").

---
 INSTALL             |  8 ++++++++
 Makeconfig          |  6 +++++-
 configure           | 15 +++++++++++++++
 configure.ac        |  8 ++++++++
 manual/install.texi |  7 +++++++
 5 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/INSTALL b/INSTALL
index a56179a9c9..31531549de 100644
--- a/INSTALL
+++ b/INSTALL
@@ -130,6 +130,14 @@ passed to 'configure'.  For example:
      systems support shared libraries; you need ELF support and
      (currently) the GNU linker.
 
+'--disable-libsupport'
+     Do not build the internal test suite support library.  This library
+     is only required if the test suite is to be built.  When
+     bootstrapping the GNU C Library, it may not be possible to run the
+     test suite anyway.  Such bootstrap builds can use
+     '--disable-libsupport' and avoid complications related to the test
+     suite support library.
+
 '--disable-default-pie'
      Don't build glibc programs and the testsuite as position
      independent executables (PIE). By default, glibc programs and tests
diff --git a/Makeconfig b/Makeconfig
index a2ea4f6a33..6bb73f805d 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1393,9 +1393,13 @@ all-subdirs = csu assert ctype locale intl catgets math setjmp signal	    \
 	      stdlib stdio-common libio malloc string wcsmbs time dirent    \
 	      posix io termios resource misc socket sysvipc gmon            \
 	      gnulib iconv iconvdata wctype manual po argp                  \
-	      localedata timezone rt conform debug mathvec support	    \
+	      localedata timezone rt conform debug mathvec		    \
 	      dlfcn elf
 
+ifeq ($(build-libsupport),yes)
+all-subdirs += support
+endif
+
 ifndef avoid-generated
 # sysd-sorted itself will contain rules making the sysd-sorted target
 # depend on Depend files.  But if you just added a Depend file to an
diff --git a/configure b/configure
index d11dcf97c5..bed060fde3 100755
--- a/configure
+++ b/configure
@@ -815,6 +815,7 @@ enable_memory_tagging
 enable_systemtap
 enable_build_nscd
 enable_nscd
+enable_libsupport
 enable_pt_chown
 enable_mathvec
 enable_cet
@@ -1494,6 +1495,7 @@ Optional Features:
   --enable-systemtap      enable systemtap static probe points [default=no]
   --disable-build-nscd    disable building and installing the nscd daemon
   --disable-nscd          library functions will not contact the nscd daemon
+  --disable-libsupport    disable building the testsuite support library
   --enable-pt_chown       Enable building and installing pt_chown
   --enable-mathvec        Enable building and installing mathvec [default
                           depends on architecture]
@@ -4782,6 +4784,17 @@ esac
 fi
 
 
+# Note the use of $use_nscd is near the bottom of the file.
+# Check whether --enable-libsupport was given.
+if test ${enable_libsupport+y}
+then :
+  enableval=$enable_libsupport; build_libsupport=$enableval
+else case e in #(
+  e) build_libsupport=yes ;;
+esac
+fi
+
+
 # Check whether --enable-pt_chown was given.
 if test ${enable_pt_chown+y}
 then :
@@ -9174,6 +9187,8 @@ fi
 printf "%s\n" "$libc_cv_have_libgcc_s" >&6; }
 config_vars="$config_vars
 have-libgcc_s = $libc_cv_have_libgcc_s"
+config_vars="$config_vars
+build-libsupport = $build_libsupport"
 
 # Support configure.ac under sysdeps.
 
diff --git a/configure.ac b/configure.ac
index d068bb5082..019381fd06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -380,6 +380,13 @@ AC_ARG_ENABLE([nscd],
 	      [use_nscd=$enableval],
 	      [use_nscd=yes])
 
+# Note the use of $use_nscd is near the bottom of the file.
+AC_ARG_ENABLE([libsupport],
+	      [AS_HELP_STRING([--disable-libsupport],
+	       [disable building the testsuite support library])],
+	      [build_libsupport=$enableval],
+	      [build_libsupport=yes])
+
 AC_ARG_ENABLE([pt_chown],
 	      [AS_HELP_STRING([--enable-pt_chown],
 	       [Enable building and installing pt_chown])],
@@ -2072,6 +2079,7 @@ AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [d
 		 [libc_cv_have_libgcc_s=yes], [libc_cv_have_libgcc_s=no])
   LIBS="$old_LIBS"])
 LIBC_CONFIG_VAR([have-libgcc_s], [$libc_cv_have_libgcc_s])
+LIBC_CONFIG_VAR([build-libsupport], [$build_libsupport])
 
 # Support configure.ac under sysdeps.
 AC_SUBST(libc_cv_test_cc_mprefer_vector_width)
diff --git a/manual/install.texi b/manual/install.texi
index d001e8220b..20a71a4801 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -161,6 +161,13 @@ Don't build shared libraries even if it is possible.  Not all systems
 support shared libraries; you need ELF support and (currently) the GNU
 linker.
 
+@item --disable-libsupport
+Do not build the internal test suite support library.  This library is
+only required if the test suite is to be built.  When bootstrapping
+@theglibc{}, it may not be possible to run the test suite anyway.  Such
+bootstrap builds can use @option{--disable-libsupport} and avoid
+complications related to the test suite support library.
+
 @item --disable-default-pie
 Don't build glibc programs and the testsuite as position independent
 executables (PIE).  By default, glibc programs and tests are created as

base-commit: 0544df4f4a9c6ce72de589e95f5bdadce8f103d0



More information about the Libc-alpha mailing list