diff options
-rwxr-xr-x | configure | 40 | ||||
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | support/Makefile | 5 |
3 files changed, 56 insertions, 1 deletions
@@ -9135,6 +9135,46 @@ fi config_vars="$config_vars enable-static-pie = $libc_cv_static_pie" +# Check if we can link support functionality against libgcc_s. +# Must not be used for linking installed binaries, to produce the +# same binaries for bootstrapped and bootstrapping builds (the latter +# with a GCC that does not build libgcc_s). +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC can link against -lgcc_s" >&5 +printf %s "checking whether $CC can link against -lgcc_s... " >&6; } +if test ${libc_cv_have_libgcc_s+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) old_LIBS="$LIBS" + LIBS="$LIBS -lgcc_s" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + libc_cv_have_libgcc_s=yes +else case e in #( + e) libc_cv_have_libgcc_s=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$old_LIBS" ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_libgcc_s" >&5 +printf "%s\n" "$libc_cv_have_libgcc_s" >&6; } +config_vars="$config_vars +have-libgcc_s = $libc_cv_have_libgcc_s" + # Support configure.ac under sysdeps. diff --git a/configure.ac b/configure.ac index 57cd24c..d068bb5 100644 --- a/configure.ac +++ b/configure.ac @@ -2061,6 +2061,18 @@ if test "$libc_cv_static_pie" = "yes"; then fi LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie]) +# Check if we can link support functionality against libgcc_s. +# Must not be used for linking installed binaries, to produce the +# same binaries for bootstrapped and bootstrapping builds (the latter +# with a GCC that does not build libgcc_s). +AC_CACHE_CHECK([whether $CC can link against -lgcc_s], libc_cv_have_libgcc_s, [dnl + old_LIBS="$LIBS" + LIBS="$LIBS -lgcc_s" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [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]) + # Support configure.ac under sysdeps. AC_SUBST(libc_cv_test_cc_mprefer_vector_width) AC_SUBST(test_enable_cet) diff --git a/support/Makefile b/support/Makefile index 0c67055..ea7b4cd 100644 --- a/support/Makefile +++ b/support/Makefile @@ -282,7 +282,10 @@ CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 ifeq (,$(CXX)) LINKS_DSO_PROGRAM = links-dso-program-c CFLAGS-links-dso-program-c.c += -fexceptions -LDLIBS-links-dso-program-c = -lgcc -lgcc_s $(libunwind) +LDLIBS-links-dso-program-c = -lgcc +ifeq ($(have-libgcc_s),yes) +LDLIBS-links-dso-program-c += -lgcc_s $(libunwind) +endif else LINKS_DSO_PROGRAM = links-dso-program LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) |