Hi,

When I ran Asan tests under Asan-bootstrapped GCC 5.0, I've noted, that tests for libiberty and libbacktrace fail to link with sanitized libbacktrace.a and libiberty.a because of missing -static-libasan -fsanitize=address linker flags.

This patch adds necessary flags to provide a linkage of these tests in bootstrap-asan case.

I've checked that regression tests pass with disabled bootstrap, normal bootstrap (stage1, stage3) and Asan-bootstrap (stage 1, stage3) on x86_64-pc-linux-gnu.

Does the patch look sane?

-Maxim
libiberty/ChangeLog:

2014-08-25  Max Ostapenko  <m.ostape...@partner.samsung.com>

	* testsuite/Makefile.in(LIBCFLAGS): Add LDFLAGS.

ChangeLog:

2014-08-25  Max Ostapenko  <m.ostape...@partner.samsung.com>

	* Makefile.in (EXTRA_HOST_EXPORTS): New variables.
	(EXTRA_BOOTSTRAP_FLAGS): Likewise.
	(check-libiberty): Add EXTRA_HOST_EXPORTS and EXTRA_BOOTSTRAP_FLAGS.
	(check-libbacktrace): Likewise.

diff --git a/Makefile.in b/Makefile.in
index add8cf6..93d48b8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -20541,8 +20541,9 @@ check-libbacktrace:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
+	$(EXTRA_HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/libbacktrace && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS)  check)
 
 @endif libbacktrace
 
@@ -23597,6 +23598,13 @@ clean-stagefeedback-libiberty:
 @endif libiberty-bootstrap
 
 
+@if gcc-bootstrap
+EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \
+	  $(POSTSTAGE1_HOST_EXPORTS) \
+	 fi ;
+
+EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS"
+@endif gcc-bootstrap
 
 
 
@@ -23610,8 +23618,9 @@ check-libiberty:
 	@r=`${PWD_COMMAND}`; export r; \
 	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
 	$(HOST_EXPORTS) \
+	$(EXTRA_HOST_EXPORTS) \
 	(cd $(HOST_SUBDIR)/libiberty && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
+	  $(MAKE) $(FLAGS_TO_PASS) $(EXTRA_BOOTSTRAP_FLAGS)  check)
 
 @endif libiberty
 
diff --git a/libiberty/testsuite/Makefile.in b/libiberty/testsuite/Makefile.in
index d23c09c..ef693c2 100644
--- a/libiberty/testsuite/Makefile.in
+++ b/libiberty/testsuite/Makefile.in
@@ -33,7 +33,7 @@ SHELL = @SHELL@
 
 CC = @CC@
 CFLAGS = @CFLAGS@
-LIBCFLAGS = $(CFLAGS)
+LIBCFLAGS = $(CFLAGS) $(LDFLAGS)
 
 # Multilib support variables.
 MULTISRCTOP =

Reply via email to