public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Filter out -fsanitize=address if not in combined tree in libiberty
Date: Fri, 30 Nov 2012 09:01:00 -0000	[thread overview]
Message-ID: <CAFiYyc3ykG1co0gDxmDyQgmm37xE1-EUE9rnzbgWqnCDyugCMg@mail.gmail.com> (raw)
In-Reply-To: <20121129174031.GA31369@intel.com>

On Thu, Nov 29, 2012 at 6:40 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> When GCC is configured with --with-build-config="bootstrap-asan", all
> -flto tests will fail since -fsanitize=address is used to compile host
> libiberty, which is used to create liblto_plugin.so, and linker isn't
> compiled with -fsanitize=address.  This patch filters out
> -fsanitize=address from CFLAGS if we aren't in a combined tree with
> binutils.  OK to install?

Why not simply ensure that only host _executables_ are sanitized?

Richard.

> Thanks.
>
> H.J.
> ---
> 2012-11-21  H.J. Lu  <hongjiu.lu@intel.com>
>
>         * Makefile.in (CFLAGS): Filter out -fsanitize=address if in GCC
>         tree, but not in a combined tree with binutils.
>         * configure.ac (COMBINED_TREE_FALSE): New AC_SUBST.
>         * configure: Regenerated.
>
> diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
> index 1ba8cf1..2d357d7 100644
> --- a/libiberty/Makefile.in
> +++ b/libiberty/Makefile.in
> @@ -63,6 +63,10 @@ PERL = @PERL@
>
>  PICFLAG = @PICFLAG@
>
> +# Filter out -fsanitize=address if we are in GCC tree, but aren't in a
> +# combined tree with binutils.
> +@COMBINED_TREE_FALSE@override CFLAGS := $(filter-out -fsanitize=address,$(CFLAGS))
> +
>  MAKEOVERRIDES =
>
>  TARGETLIB = ./libiberty.a
> diff --git a/libiberty/configure b/libiberty/configure
> index 5367027..4869cd5 100755
> --- a/libiberty/configure
> +++ b/libiberty/configure
> @@ -590,6 +590,7 @@ ac_includes_default="\
>
>  ac_subst_vars='LTLIBOBJS
>  INSTALL_DEST
> +COMBINED_TREE_FALSE
>  pexecute
>  target_header_dir
>  CHECK
> @@ -6917,6 +6918,20 @@ esac
>  fi
>
>
> +# Check if this is in GCC tree, but aren't in a combined tree with
> +# binutils.
> +if test -e ${srcdir}/../gcc/gcc.c; then
> +  if test -e ${srcdir}/../ld/ldmain.c -o \
> +         -e ${top_srcdir}/../gold/version.cc; then
> +    COMBINED_TREE_FALSE='#'
> +  else
> +    COMBINED_TREE_FALSE=''
> +  fi
> +else
> +  COMBINED_TREE_FALSE='#'
> +fi
> +
> +
>  # Install a library built with a cross compiler in $(tooldir) rather
>  # than $(libdir).
>  if test -z "${with_cross_host}"; then
> diff --git a/libiberty/configure.ac b/libiberty/configure.ac
> index c763894..7661752 100644
> --- a/libiberty/configure.ac
> +++ b/libiberty/configure.ac
> @@ -670,6 +670,20 @@ AC_SUBST(pexecute)
>
>  libiberty_AC_FUNC_STRNCMP
>
> +# Check if this is in GCC tree, but aren't in a combined tree with
> +# binutils.
> +if test -e ${srcdir}/../gcc/gcc.c; then
> +  if test -e ${srcdir}/../ld/ldmain.c -o \
> +         -e ${top_srcdir}/../gold/version.cc; then
> +    COMBINED_TREE_FALSE='#'
> +  else
> +    COMBINED_TREE_FALSE=''
> +  fi
> +else
> +  COMBINED_TREE_FALSE='#'
> +fi
> +AC_SUBST(COMBINED_TREE_FALSE)
> +
>  # Install a library built with a cross compiler in $(tooldir) rather
>  # than $(libdir).
>  if test -z "${with_cross_host}"; then
> --
> 1.7.11.7
>

  reply	other threads:[~2012-11-30  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 17:38 [PATCH Filter out -fsanitize=address if not in combined tree in lto-plugin H.J. Lu
2012-11-29 17:40 ` [PATCH] Filter out -fsanitize=address if not in combined tree in libiberty H.J. Lu
2012-11-30  9:01   ` Richard Biener [this message]
2012-11-30 13:17     ` H.J. Lu
2012-11-30 13:33       ` Richard Biener
2012-11-30 14:21         ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc3ykG1co0gDxmDyQgmm37xE1-EUE9rnzbgWqnCDyugCMg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).