On Mon, Jan 12, 2026 at 12:13:35PM +0100, Florian Weimer wrote:
> One way to work around the libtool problem would be to stick the
> as-needed into an existing .so linker script, or create a new one under
> a different name (say libatomic_optional.so) that has AS_NEEDED in it,
> and link with -latomic_optional.  Then libtool would not have to be
> taught about --push-state/--pop-state etc.

That seems to work.

So far bootstrapped (c,c++,fortran,lto only) and make install tested
on x86_64-linux, tested on a small program without need to libatomic and
struct S { char a[25]; };
_Atomic struct S s;

int main () { struct S t = s; s = t; }
which does at -O0.
Before this patch I got
for i in `find x86_64-pc-linux-gnu/ -name lib\*.so.\*.\*`; do ldd -u $i 2>&1 | 
grep -q libatomic.so.1 && echo $i; done
x86_64-pc-linux-gnu/libsanitizer/ubsan/.libs/libubsan.so.1.0.0
x86_64-pc-linux-gnu/libsanitizer/asan/.libs/libasan.so.8.0.0
x86_64-pc-linux-gnu/libsanitizer/hwasan/.libs/libhwasan.so.0.0.0
x86_64-pc-linux-gnu/libsanitizer/lsan/.libs/liblsan.so.0.0.0
x86_64-pc-linux-gnu/libsanitizer/tsan/.libs/libtsan.so.2.0.0
x86_64-pc-linux-gnu/32/libsanitizer/ubsan/.libs/libubsan.so.1.0.0
x86_64-pc-linux-gnu/32/libsanitizer/asan/.libs/libasan.so.8.0.0
x86_64-pc-linux-gnu/32/libstdc++-v3/src/.libs/libstdc++.so.6.0.35
x86_64-pc-linux-gnu/libgcobol/.libs/libgcobol.so.2.0.0
x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.35
With this patch it prints nothing.

Ok for trunk if it passes full bootstrap/regtest?

2026-01-12  Jakub Jelinek  <[email protected]>

        PR libstdc++/123396
gcc/
        * configure.ac (gcc_cv_ld_use_as_needed_ldscript): New test.
        (USE_LD_AS_NEEDED_LDSCRIPT): New AC_DEFINE.
        * gcc.cc (LINK_LIBATOMIC_SPEC): Use "-latomic_asneeded" instead
        of LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION
        if USE_LD_AS_NEEDED_LDSCRIPT is defined.
        (init_gcc_specs): Use "-lgcc_s_asneeded" instead of
        LD_AS_NEEDED_OPTION " -lgcc_s " LD_NO_AS_NEEDED_OPTION
        if USE_LD_AS_NEEDED_LDSCRIPT is defined.
        * config.in: Regenerate.
        * configure: Regenerate.
libatomic/
        * acinclude.m4 (LIBAT_BUILD_ASNEEDED_SOLINK): New AM_CONDITIONAL.
        * libatomic_asneeded.so: New file.
        * libatomic_asneeded.a: New file.
        * Makefile.am (toolexeclib_DATA): Set if LIBAT_BUILD_ASNEEDED_SOLINK.
        (all-local): Install those files into gcc subdir.
        * Makefile.in: Regenerate.
        * configure: Regenerate.
libgcc/
        * config/t-slibgcc (SHLIB_ASNEEDED_SOLINK,
        SHLIB_MAKE_ASNEEDED_SOLINK, SHLIB_INSTALL_ASNEEDED_SOLINK): New
        vars.
        (SHLIB_LINK): Include $(SHLIB_MAKE_ASNEEDED_SOLINK).
        (SHLIB_INSTALL): Include $(SHLIB_INSTALL_ASNEEDED_SOLINK).

--- gcc/configure.ac.jj 2026-01-09 22:19:56.399735314 +0100
+++ gcc/configure.ac    2026-01-12 15:54:36.883949085 +0100
@@ -6652,10 +6652,12 @@ gcc_cv_ld_as_needed,
 [gcc_cv_ld_as_needed=no
 gcc_cv_ld_as_needed_option='--as-needed'
 gcc_cv_ld_no_as_needed_option='--no-as-needed'
+gcc_cv_ld_use_as_needed_ldscript=no
 if test $in_tree_ld = yes ; then
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 
16 -o "$gcc_cv_gld_major_version" -gt 2 \
      && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_as_needed=yes
+    gcc_cv_ld_use_as_needed_ldscript=yes
     if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" 
-ge 28; then
       gcc_cv_ld_as_needed_option='--push-state --as-needed'
       gcc_cv_ld_no_as_needed_option='--pop-state'
@@ -6665,6 +6667,7 @@ elif test x$gcc_cv_ld != x; then
   # Check if linker supports --as-needed and --no-as-needed options
   if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then
     gcc_cv_ld_as_needed=yes
+    gcc_cv_ld_use_as_needed_ldscript=yes
     if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null \
        && $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null \
        && echo "$ld_ver" | grep GNU > /dev/null \
@@ -6683,6 +6686,7 @@ elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_as_needed=yes
       gcc_cv_ld_as_needed_option="-z ignore"
       gcc_cv_ld_no_as_needed_option="-z record"
+      gcc_cv_ld_use_as_needed_ldscript=no
       ;;
   esac
 fi
@@ -6691,6 +6695,7 @@ case "$target" in
     if echo "$ld_ver" | grep GNU > /dev/null; then
       # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
       gcc_cv_ld_as_needed=no
+      gcc_cv_ld_use_as_needed_ldscript=no
     fi
     ;;
 esac
@@ -6703,6 +6708,10 @@ if test x"$gcc_cv_ld_as_needed" = xyes;
        AC_DEFINE_UNQUOTED(LD_NO_AS_NEEDED_OPTION, 
"$gcc_cv_ld_no_as_needed_option",
 [Define to the linker option to keep unused dependencies.])
 fi
+if test x"$gcc_cv_ld_use_as_needed_ldscript" = xyes; then
+       AC_DEFINE(USE_LD_AS_NEEDED_LDSCRIPT, 1,
+[Define if your linker supports AS_NEEDED in linker scripts.])
+fi
 
 AC_MSG_CHECKING(linker mapfile support for clearing hardware capabilities)
 saved_LDFLAGS="$LDFLAGS"
--- gcc/gcc.cc.jj       2026-01-05 21:23:45.176633940 +0100
+++ gcc/gcc.cc  2026-01-12 15:14:58.902045473 +0100
@@ -999,8 +999,12 @@ proper position among the other output f
 /* Here is the spec for running the linker, after compiling all files.  */
 
 #if defined(TARGET_PROVIDES_LIBATOMIC) && defined(USE_LD_AS_NEEDED)
+#ifdef USE_LD_AS_NEEDED_LDSCRIPT
+#define LINK_LIBATOMIC_SPEC "%{!fno-link-libatomic:-latomic_asneeded} "
+#else
 #define LINK_LIBATOMIC_SPEC "%{!fno-link-libatomic:" LD_AS_NEEDED_OPTION \
                            " -latomic " LD_NO_AS_NEEDED_OPTION "} "
+#endif
 #else
 #define LINK_LIBATOMIC_SPEC ""
 #endif
@@ -1845,6 +1849,16 @@ init_gcc_specs (struct obstack *obstack,
   char *buf;
 
 #if USE_LD_AS_NEEDED
+#if defined(USE_LD_AS_NEEDED_LDSCRIPT) && !defined(USE_LIBUNWIND_EXCEPTIONS)
+  buf = concat ("%{static|static-libgcc|static-pie:", static_name, " ", 
eh_name, "}"
+               "%{!static:%{!static-libgcc:%{!static-pie:"
+               "%{!shared-libgcc:",
+               static_name, " ",
+               shared_name, "_asneeded}"
+               "%{shared-libgcc:",
+               shared_name, "%{!shared: ", static_name, "}"
+               "}}"
+#else
   buf = concat ("%{static|static-libgcc|static-pie:", static_name, " ", 
eh_name, "}"
                "%{!static:%{!static-libgcc:%{!static-pie:"
                "%{!shared-libgcc:",
@@ -1854,6 +1868,7 @@ init_gcc_specs (struct obstack *obstack,
                "%{shared-libgcc:",
                shared_name, "%{!shared: ", static_name, "}"
                "}}"
+#endif
 #else
   buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}"
                "%{!static:%{!static-libgcc:"
--- gcc/config.in.jj    2025-12-30 22:20:58.421132957 +0100
+++ gcc/config.in       2026-01-12 15:07:20.689375401 +0100
@@ -2658,6 +2658,12 @@
 #endif
 
 
+/* Define if your linker supports AS_NEEDED in linker scripts. */
+#ifndef USED_FOR_TARGET
+#undef USE_LD_AS_NEEDED_LDSCRIPT
+#endif
+
+
 /* Define to 1 if the 'long long' type is wider than 'long' but still
    efficiently supported by the host hardware. */
 #ifndef USED_FOR_TARGET
--- gcc/configure.jj    2026-01-09 22:19:56.398735331 +0100
+++ gcc/configure       2026-01-12 15:54:43.900829005 +0100
@@ -33445,10 +33445,12 @@ else
   gcc_cv_ld_as_needed=no
 gcc_cv_ld_as_needed_option='--as-needed'
 gcc_cv_ld_no_as_needed_option='--no-as-needed'
+gcc_cv_ld_use_as_needed_ldscript=no
 if test $in_tree_ld = yes ; then
   if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 
16 -o "$gcc_cv_gld_major_version" -gt 2 \
      && test $in_tree_ld_is_elf = yes; then
     gcc_cv_ld_as_needed=yes
+    gcc_cv_ld_use_as_needed_ldscript=yes
     if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" 
-ge 28; then
       gcc_cv_ld_as_needed_option='--push-state --as-needed'
       gcc_cv_ld_no_as_needed_option='--pop-state'
@@ -33458,6 +33460,7 @@ elif test x$gcc_cv_ld != x; then
   # Check if linker supports --as-needed and --no-as-needed options
   if $gcc_cv_ld --help 2>&1 | grep as-needed > /dev/null; then
     gcc_cv_ld_as_needed=yes
+    gcc_cv_ld_use_as_needed_ldscript=yes
     if $gcc_cv_ld --help 2>&1 | grep push-state > /dev/null \
        && $gcc_cv_ld --help 2>&1 | grep pop-state > /dev/null \
        && echo "$ld_ver" | grep GNU > /dev/null \
@@ -33476,6 +33479,7 @@ elif test x$gcc_cv_ld != x; then
       gcc_cv_ld_as_needed=yes
       gcc_cv_ld_as_needed_option="-z ignore"
       gcc_cv_ld_no_as_needed_option="-z record"
+      gcc_cv_ld_use_as_needed_ldscript=no
       ;;
   esac
 fi
@@ -33484,6 +33488,7 @@ case "$target" in
     if echo "$ld_ver" | grep GNU > /dev/null; then
       # Doesn't work with gld on Solaris/x86 due to PR ld/12320.
       gcc_cv_ld_as_needed=no
+      gcc_cv_ld_use_as_needed_ldscript=no
     fi
     ;;
 esac
@@ -33506,6 +33511,11 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 fi
+if test x"$gcc_cv_ld_use_as_needed_ldscript" = xyes; then
+
+$as_echo "#define USE_LD_AS_NEEDED_LDSCRIPT 1" >>confdefs.h
+
+fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker mapfile support for 
clearing hardware capabilities" >&5
 $as_echo_n "checking linker mapfile support for clearing hardware 
capabilities... " >&6; }
--- libgcc/config/t-slibgcc.jj  2026-01-02 22:41:17.522549527 +0100
+++ libgcc/config/t-slibgcc     2026-01-12 14:13:29.941245725 +0100
@@ -30,6 +30,15 @@ SHLIB_LC = -lc
 SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
 SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
        $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
+SHLIB_ASNEEDED_SOLINK = @shlib_base_name@_asneeded.so
+SHLIB_MAKE_ASNEEDED_SOLINK = \
+        (echo "/* GNU ld script"; \
+         echo "   Add DT_NEEDED entry for libgcc_s.so only if needed.  */"; \
+         echo "INPUT ( AS_NEEDED ( -lgcc_s ) )" \
+        ) > $(SHLIB_DIR)/$(SHLIB_ASNEEDED_SOLINK)
+SHLIB_INSTALL_ASNEEDED_SOLINK = \
+        $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_ASNEEDED_SOLINK) \
+          $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_ASNEEDED_SOLINK)
 
 SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
        $(SHLIB_LDFLAGS) $(LDFLAGS) \
@@ -41,7 +50,8 @@ SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -sh
                $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
        else true; fi && \
        mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
-       $(SHLIB_MAKE_SOLINK)
+       $(SHLIB_MAKE_SOLINK) && \
+       $(SHLIB_MAKE_ASNEEDED_SOLINK)
 
 INSTALL_SHLIB = $(INSTALL_DATA)
 
@@ -50,4 +60,5 @@ SHLIB_INSTALL = \
        $(INSTALL_SHLIB) $(SHLIB_DIR)/$(SHLIB_SONAME) \
          $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SONAME); \
        rm -f $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK); \
-       $(SHLIB_INSTALL_SOLINK)
+       $(SHLIB_INSTALL_SOLINK); \
+       $(SHLIB_INSTALL_ASNEEDED_SOLINK)
--- libatomic/acinclude.m4.jj   2025-11-19 23:28:44.359321440 +0100
+++ libatomic/acinclude.m4      2026-01-12 15:52:53.376720395 +0100
@@ -345,9 +345,14 @@ AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES],
   changequote(,)
   ldver=`$LD --version 2>/dev/null |
          sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
+  ldasneeded=`$LD --help 2>/dev/null | grep as-needed`
   changequote([,])
   libat_gnu_ld_version=`echo $ldver | \
          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+  libat_ld_asneeded=no
+  if test -n "$ldasneeded"; then
+    libat_ld_asneeded=yes
+  fi
 
   # Set --gc-sections.
   if test "$with_gnu_ld" = "notbroken"; then
@@ -394,6 +399,7 @@ AC_DEFUN([LIBAT_CHECK_LINKER_FEATURES],
 
   AC_SUBST(SECTION_LDFLAGS)
   AC_SUBST(OPT_LDFLAGS)
+  AM_CONDITIONAL(LIBAT_BUILD_ASNEEDED_SOLINK, test $libat_ld_asneeded != no)
 ])
 
 
--- libatomic/libatomic_asneeded.so.jj  2026-01-12 14:55:16.936306111 +0100
+++ libatomic/libatomic_asneeded.so     2026-01-12 14:55:10.355419981 +0100
@@ -0,0 +1,3 @@
+/* GNU ld script
+   Add DT_NEEDED entry for -latomic only if needed.  */
+INPUT ( AS_NEEDED ( -latomic ) )
--- libatomic/libatomic_asneeded.a.jj   2026-01-12 14:55:24.808169903 +0100
+++ libatomic/libatomic_asneeded.a      2026-01-12 14:55:58.313590157 +0100
@@ -0,0 +1,3 @@
+/* GNU ld script
+   Just link in libatomic.a.  */
+INPUT ( libatomic.a )
--- libatomic/Makefile.am.jj    2026-01-02 22:41:17.437550936 +0100
+++ libatomic/Makefile.am       2026-01-12 15:00:34.438836454 +0100
@@ -40,6 +40,9 @@ AM_CCASFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 
 toolexeclib_LTLIBRARIES = libatomic.la
+if LIBAT_BUILD_ASNEEDED_SOLINK
+toolexeclib_DATA = libatomic_asneeded.so libatomic_asneeded.a
+endif
 noinst_LTLIBRARIES = libatomic_convenience.la
 
 if LIBAT_BUILD_VERSIONED_SHLIB
@@ -183,6 +186,10 @@ all-multi: $(libatomic_la_LIBADD)
 gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
 all-local: libatomic.la
        $(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la 
$(gcc_objdir)$(MULTISUBDIR)/
+if LIBAT_BUILD_ASNEEDED_SOLINK
+       $(INSTALL_DATA) $(top_srcdir)/libatomic_asneeded.so 
$(gcc_objdir)$(MULTISUBDIR)/
+       $(INSTALL_DATA) $(top_srcdir)/libatomic_asneeded.a 
$(gcc_objdir)$(MULTISUBDIR)/
+endif
        rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
 
 # target overrides
--- libatomic/Makefile.in.jj    2025-12-11 21:58:16.805551818 +0100
+++ libatomic/Makefile.in       2026-01-12 15:01:00.186978608 +0100
@@ -14,6 +14,7 @@
 
 @SET_MAKE@
 
+
 VPATH = @srcdir@
 am__is_gnu_make = { \
   if test -z '$(MAKELEVEL)'; then \
@@ -158,7 +159,8 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
+       "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 @ARCH_AARCH64_LINUX_TRUE@@PARTIAL_VXWORKS_FALSE@am__objects_1 =  \
 @ARCH_AARCH64_LINUX_TRUE@@PARTIAL_VXWORKS_FALSE@       atomic_16.lo
@@ -244,6 +246,7 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+DATA = $(toolexeclib_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -422,6 +425,7 @@ AM_CFLAGS = $(XCFLAGS)
 AM_CCASFLAGS = $(XCFLAGS)
 AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS)
 toolexeclib_LTLIBRARIES = libatomic.la
+@LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@toolexeclib_DATA = libatomic_asneeded.so 
libatomic_asneeded.a
 noinst_LTLIBRARIES = libatomic_convenience.la
 @LIBAT_BUILD_VERSIONED_SHLIB_FALSE@libatomic_version_script = 
 
@LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBAT_BUILD_VERSIONED_SHLIB_TRUE@libatomic_version_script
 = -Wl,--version-script,$(top_srcdir)/libatomic.map
@@ -667,6 +671,27 @@ clean-libtool:
 
 distclean-libtool:
        -rm -f libtool config.lt
+install-toolexeclibDATA: $(toolexeclib_DATA)
+       @$(NORMAL_INSTALL)
+       @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+       if test -n "$$list"; then \
+         echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+       fi; \
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
+       done
+
+uninstall-toolexeclibDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -775,10 +800,10 @@ distclean-tags:
        -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
 check-am: all-am
 check: check-recursive
-all-am: Makefile $(LTLIBRARIES) auto-config.h all-local
+all-am: Makefile $(LTLIBRARIES) $(DATA) auto-config.h all-local
 installdirs: installdirs-recursive
 installdirs-am:
-       for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+       for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)"; 
do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-recursive
@@ -842,7 +867,8 @@ install-dvi: install-dvi-recursive
 
 install-dvi-am:
 
-install-exec-am: install-exec-local install-toolexeclibLTLIBRARIES
+install-exec-am: install-exec-local install-toolexeclibDATA \
+       install-toolexeclibLTLIBRARIES
 
 install-html: install-html-recursive
 
@@ -885,7 +911,8 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-toolexeclibDATA \
+       uninstall-toolexeclibLTLIBRARIES
 
 .MAKE: $(am__recursive_targets) all install-am install-strip
 
@@ -900,12 +927,14 @@ uninstall-am: uninstall-toolexeclibLTLIB
        install-exec install-exec-am install-exec-local install-html \
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip install-toolexeclibLTLIBRARIES installcheck \
-       installcheck-am installdirs installdirs-am maintainer-clean \
+       install-strip install-toolexeclibDATA \
+       install-toolexeclibLTLIBRARIES installcheck installcheck-am \
+       installdirs installdirs-am maintainer-clean \
        maintainer-clean-generic maintainer-clean-local mostlyclean \
        mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
        mostlyclean-local pdf pdf-am ps ps-am tags tags-am uninstall \
-       uninstall-am uninstall-toolexeclibLTLIBRARIES
+       uninstall-am uninstall-toolexeclibDATA \
+       uninstall-toolexeclibLTLIBRARIES
 
 .PRECIOUS: Makefile
 
@@ -931,6 +960,8 @@ vpath % $(strip $(search_path))
 all-multi: $(libatomic_la_LIBADD)
 all-local: libatomic.la
        $(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la 
$(gcc_objdir)$(MULTISUBDIR)/
+@LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     $(INSTALL_DATA) 
$(top_srcdir)/libatomic_asneeded.so $(gcc_objdir)$(MULTISUBDIR)/
+@LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     $(INSTALL_DATA) 
$(top_srcdir)/libatomic_asneeded.a $(gcc_objdir)$(MULTISUBDIR)/
        rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
 
 # target overrides
--- libatomic/configure.jj      2025-12-30 22:20:58.527131163 +0100
+++ libatomic/configure 2026-01-12 15:53:04.676527024 +0100
@@ -656,6 +656,8 @@ LIBAT_BUILD_VERSIONED_SHLIB_GNU_FALSE
 LIBAT_BUILD_VERSIONED_SHLIB_GNU_TRUE
 LIBAT_BUILD_VERSIONED_SHLIB_FALSE
 LIBAT_BUILD_VERSIONED_SHLIB_TRUE
+LIBAT_BUILD_ASNEEDED_SOLINK_FALSE
+LIBAT_BUILD_ASNEEDED_SOLINK_TRUE
 OPT_LDFLAGS
 SECTION_LDFLAGS
 PARTIAL_VXWORKS_FALSE
@@ -11864,7 +11866,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11867 "configure"
+#line 11869 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11970,7 +11972,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11973 "configure"
+#line 11975 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15731,9 +15733,14 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
   ldver=`$LD --version 2>/dev/null |
          sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'`
+  ldasneeded=`$LD --help 2>/dev/null | grep as-needed`
 
   libat_gnu_ld_version=`echo $ldver | \
          $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
+  libat_ld_asneeded=no
+  if test -n "$ldasneeded"; then
+    libat_ld_asneeded=yes
+  fi
 
   # Set --gc-sections.
   if test "$with_gnu_ld" = "notbroken"; then
@@ -15797,6 +15804,14 @@ $as_echo "$ac_sectionLDflags" >&6; }
 
 
 
+   if test $libat_ld_asneeded != no; then
+  LIBAT_BUILD_ASNEEDED_SOLINK_TRUE=
+  LIBAT_BUILD_ASNEEDED_SOLINK_FALSE='#'
+else
+  LIBAT_BUILD_ASNEEDED_SOLINK_TRUE='#'
+  LIBAT_BUILD_ASNEEDED_SOLINK_FALSE=
+fi
+
 
 
 
@@ -16442,6 +16457,10 @@ if test -z "${PARTIAL_VXWORKS_TRUE}" &&
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
+if test -z "${LIBAT_BUILD_ASNEEDED_SOLINK_TRUE}" && test -z 
"${LIBAT_BUILD_ASNEEDED_SOLINK_FALSE}"; then
+  as_fn_error $? "conditional \"LIBAT_BUILD_ASNEEDED_SOLINK\" was never 
defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${LIBAT_BUILD_VERSIONED_SHLIB_TRUE}" && test -z 
"${LIBAT_BUILD_VERSIONED_SHLIB_FALSE}"; then
   as_fn_error $? "conditional \"LIBAT_BUILD_VERSIONED_SHLIB\" was never 
defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5


        Jakub

Reply via email to