re PR sanitizer/56781 (boostrap-asan failure: fixincl fails to link (missing -lasan))

PR sanitizer/56781
lto-plugin/
	* Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize=address.
	(liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS,
	liblto_plugin_la_DEPENDENCIES): Prefer ../libiberty/noasan/libiberty.a
	over ../libiberty/pic/libiberty.a if the former exists.
	* Makefile.in: Regenerated.
libiberty/
	* maint-tool: Also emit rule for noasan/ subdirectory.
	* configure.ac (NOASANFLAG): Set and substitute.
	* Makefile.in: Regenerated.
	(NOASANFLAG): Set.
	(all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic
	subdir.
	(stamp-noasandir): New goal.
	* configure: Regenerated.

From-SVN: r209476
This commit is contained in:
Jakub Jelinek 2014-04-17 14:25:25 +02:00 committed by Jakub Jelinek
parent ffe7f7a75f
commit 4f148bbc73
8 changed files with 428 additions and 15 deletions

View File

@ -1,3 +1,15 @@
2014-04-17 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/56781
* maint-tool: Also emit rule for noasan/ subdirectory.
* configure.ac (NOASANFLAG): Set and substitute.
* Makefile.in: Regenerated.
(NOASANFLAG): Set.
(all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic
subdir.
(stamp-noasandir): New goal.
* configure: Regenerated.
2014-04-01 Richard Biener <rguenther@suse.de>
* simple-object.c (simple_object_internal_write): Handle

File diff suppressed because it is too large Load Diff

7
libiberty/configure vendored
View File

@ -594,6 +594,7 @@ pexecute
target_header_dir
CHECK
LIBOBJS
NOASANFLAG
PICFLAG
INSTALL_DATA
INSTALL_SCRIPT
@ -4971,6 +4972,12 @@ if [ "${shared}" != "yes" ]; then
fi
NOASANFLAG=
case " ${CFLAGS} " in
*\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
esac
echo "# Warning: this fragment is automatically generated" > temp-frag
if [ -n "${frag}" ] && [ -f "${frag}" ]; then

View File

@ -236,6 +236,12 @@ if [[ "${shared}" != "yes" ]]; then
fi
AC_SUBST(PICFLAG)
NOASANFLAG=
case " ${CFLAGS} " in
*\ -fsanitize=address\ *) NOASANFLAG=-fno-sanitize=address ;;
esac
AC_SUBST(NOASANFLAG)
echo "# Warning: this fragment is automatically generated" > temp-frag
if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then

View File

@ -1,7 +1,7 @@
#!/usr/bin/perl
# -*- perl -*-
# Copyright (C) 2001, 2007, 2010
# Copyright (C) 2001, 2007, 2010, 2014
# Free Software Foundation
#
# This file is part of the libiberty library.
@ -215,6 +215,9 @@ sub deps {
$crule = "\tif [ x\"\$(PICFLAG)\" != x ]; then \\\n";
$crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$< -o pic/\$@; \\\n";
$crule .= "\telse true; fi\n";
$crule .= "\tif [ x\"\$(NOASANFLAG)\" != x ]; then \\\n";
$crule .= "\t \$(COMPILE.c) \$(PICFLAG) \$(NOASANFLAG) \$< -o noasan/\$@; \\\n";
$crule .= "\telse true; fi\n";
$crule .= "\t\$(COMPILE.c) \$< \$(OUTPUT_OPTION)\n";
$crule .= "\n";

View File

@ -1,5 +1,12 @@
2014-04-17 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/56781
* Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize=address.
(liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS,
liblto_plugin_la_DEPENDENCIES): Prefer ../libiberty/noasan/libiberty.a
over ../libiberty/pic/libiberty.a if the former exists.
* Makefile.in: Regenerated.
PR sanitizer/56781
* Makefile.am (LTLDFLAGS, liblto_plugin_la_LINK): New variables.
* Makefile.in: Regenerated.

View File

@ -11,6 +11,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/../include $(DEFS)
AM_CFLAGS = @ac_lto_plugin_warn_cflags@
AM_LDFLAGS = @ac_lto_plugin_ldflags@
AM_LIBTOOLFLAGS = --tag=disable-static
override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
libexecsub_LTLIBRARIES = liblto_plugin.la
gcc_build_dir = ../$(host_subdir)/gcc
@ -22,13 +24,16 @@ LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_SOURCES = lto-plugin.c
liblto_plugin_la_LIBADD = \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,)
$(if $(wildcard ../libiberty/noasan/libiberty.a),$(Wc)../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,))
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
$(lt_host_flags) -module -bindir $(libexecsubdir) \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a)
$(if $(wildcard ../libiberty/noasan/libiberty.a),, \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a))
liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
../libiberty/noasan/libiberty.a),../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,))
liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(liblto_plugin_la_LDFLAGS) $(LTLDFLAGS) -o $@

View File

@ -239,15 +239,18 @@ Wc = -Wc,
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
liblto_plugin_la_SOURCES = lto-plugin.c
liblto_plugin_la_LIBADD = \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,)
$(if $(wildcard ../libiberty/noasan/libiberty.a),$(Wc)../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),$(Wc)../libiberty/pic/libiberty.a,))
# Note that we intentionally override the bindir supplied by ACX_LT_HOST_FLAGS
liblto_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
$(lt_host_flags) -module -bindir $(libexecsubdir) \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a)
$(if $(wildcard ../libiberty/noasan/libiberty.a),, \
$(if $(wildcard ../libiberty/pic/libiberty.a),,-Wc,../libiberty/libiberty.a))
liblto_plugin_la_DEPENDENCIES = $(if $(wildcard \
../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,)
../libiberty/noasan/libiberty.a),../libiberty/noasan/libiberty.a, \
$(if $(wildcard ../libiberty/pic/libiberty.a),../libiberty/pic/libiberty.a,))
liblto_plugin_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@ -539,6 +542,8 @@ uninstall-am: uninstall-libexecsubLTLIBRARIES
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-libexecsubLTLIBRARIES
override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
override LDFLAGS := $(filter-out -fsanitize=address,$(LDFLAGS))
all-local: $(in_gcc_libs)