#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_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'
# 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 \
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
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
#define LD_NO_AS_NEEDED_OPTION "$gcc_cv_ld_no_as_needed_option"
_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
[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'
# 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 \
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
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
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"
/* 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
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:",
"%{shared-libgcc:",
shared_name, "%{!shared: ", static_name, "}"
"}}"
+#endif
#else
buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}"
"%{!static:%{!static-libgcc:"
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
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
@SET_MAKE@
+
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
|| { 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
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 = \
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
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.
-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
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
ps-am:
-uninstall-am: uninstall-toolexeclibLTLIBRARIES
+uninstall-am: uninstall-toolexeclibDATA \
+ uninstall-toolexeclibLTLIBRARIES
.MAKE: $(am__recursive_targets) all install-am install-strip
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
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
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
AC_SUBST(SECTION_LDFLAGS)
AC_SUBST(OPT_LDFLAGS)
+ AM_CONDITIONAL(LIBAT_BUILD_ASNEEDED_SOLINK, test $libat_ld_asneeded != no)
])
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
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
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
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
+ 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
+
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
--- /dev/null
+/* GNU ld script
+ Just link in libatomic.a. */
+INPUT ( libatomic.a )
--- /dev/null
+/* GNU ld script
+ Add DT_NEEDED entry for -latomic only if needed. */
+INPUT ( AS_NEEDED ( -latomic ) )
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) \
$(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)
$(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)