diff mbox

Fix libbacktrace and libiberty tests fail on sanitized GCC due to wrong link options.

Message ID 53FAE010.30604@partner.samsung.com
State New
Headers show

Commit Message

max Aug. 25, 2014, 7:04 a.m. UTC
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

Comments

Yury Gribov Aug. 25, 2014, 2:23 p.m. UTC | #1
On 08/25/2014 11:04 AM, Maxim Ostapenko wrote:
 > This patch adds necessary flags to provide a linkage of these tests in
 > bootstrap-asan case.

I think you'll want to modify Makefile.def and Makefile.tpl because 
Makefile is generated from them.

-Y
Bernhard Reutner-Fischer Aug. 25, 2014, 3:21 p.m. UTC | #2
On 25 August 2014 16:23:54 CEST, Yury Gribov <y.gribov@samsung.com> wrote:
>On 08/25/2014 11:04 AM, Maxim Ostapenko wrote:
>> This patch adds necessary flags to provide a linkage of these tests
>in
> > bootstrap-asan case.
>
>I think you'll want to modify Makefile.def and Makefile.tpl because 
>Makefile is generated from them.

Sounds like this would fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56781

Thanks,
diff mbox

Patch

libiberty/ChangeLog:

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

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

ChangeLog:

2014-08-25  Max Ostapenko  <m.ostapenko@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 =