@@ -18,6 +18,13 @@ in_gcc_libs = $(foreach lib, $(libexecsub_LTLIBRARIES), $(gcc_build_dir)/$(lib))
# Can be removed when libiberty becomes a normal convenience library
Wc=-Wc,
+if !COMBINED_TREE
+# Filter out -fsanitize=address if we aren't in a combined tree with
+# GCC and binutils.
+override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
+override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
+endif
+
liblto_plugin_la_SOURCES = lto-plugin.c
liblto_plugin_la_LIBADD = \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,)
@@ -535,6 +535,11 @@ uninstall-am: uninstall-libexecsubLTLIBRARIES
uninstall-libexecsubLTLIBRARIES
+# Filter out -fsanitize=address if we aren't in a combined tree with
+# GCC and binutils.
+@COMBINED_TREE_FALSE@override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
+@COMBINED_TREE_FALSE@override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
+
all-local: $(in_gcc_libs)
$(in_gcc_libs) : $(gcc_build_dir)/%: %
@@ -597,7 +597,9 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='am__EXEEXT_FALSE
+ac_subst_vars='COMBINED_TREE_FALSE
+COMBINED_TREE_TRUE
+am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
@@ -10552,7 +10554,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10555 "configure"
+#line 10557 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10658,7 +10660,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10661 "configure"
+#line 10663 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13318,3 +13320,13 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Check if this is a combined tree with GCC and binutils.
+ if test -e ${ac_top_srcdir}/ld/ldmain.c -o -e ${ac_top_srcdir}/gold/version.cc; then
+ COMBINED_TREE_TRUE=
+ COMBINED_TREE_FALSE='#'
+else
+ COMBINED_TREE_TRUE='#'
+ COMBINED_TREE_FALSE=
+fi
+
@@ -16,3 +16,7 @@ AC_HEADER_SYS_WAIT
AC_CONFIG_FILES(Makefile)
AC_CONFIG_HEADERS(config.h)
AC_OUTPUT
+
+# Check if this is a combined tree with GCC and binutils.
+AM_CONDITIONAL(COMBINED_TREE,
+ test -e ${ac_top_srcdir}/ld/ldmain.c -o -e ${ac_top_srcdir}/gold/version.cc)