Il 11/12/2012 14:47, H.J. Lu ha scritto:
> On Thu, Dec 6, 2012 at 7:07 AM, H.J. Lu <hjl.to...@gmail.com> wrote:
>> On Thu, Nov 29, 2012 at 10:30 AM, H.J. Lu <hongjiu...@intel.com> wrote:
>>> Hi,
>>>
>>> Since libsanitizer is used for bootstrap and compiled with raw_cxx,
>>> we need to use explicit -I for libstdc++-v3 header files in
>>> libsanitizer.  Otherwise, we will get
>>>
>>> libtool: compile: unrecognized option `-D_GNU_SOURCE'
>>> libtool: compile: Try `libtool --help' for more information.
>>>
>>> This patch fixes it.  OK to install?
>>>
>>> Thanks.
>>>
>>>
>>> H.J.
>>> ---
>>>  libsanitizer/Makefile.am                  |  2 --
>>>  libsanitizer/Makefile.in                  |  6 +++---
>>>  libsanitizer/aclocal.m4                   |  1 +
>>>  libsanitizer/asan/Makefile.am             |  6 ++++--
>>>  libsanitizer/asan/Makefile.in             | 14 ++++++++++----
>>>  libsanitizer/configure                    | 22 ++++++++++++++++++++--
>>>  libsanitizer/configure.ac                 |  1 +
>>>  libsanitizer/interception/Makefile.am     |  6 ++++--
>>>  libsanitizer/interception/Makefile.in     | 14 ++++++++++----
>>>  libsanitizer/sanitizer_common/Makefile.am |  6 ++++--
>>>  libsanitizer/sanitizer_common/Makefile.in | 14 ++++++++++----
>>>  libsanitizer/tsan/Makefile.am             |  6 ++++--
>>>  libsanitizer/tsan/Makefile.in             | 13 +++++++++----
>>>  14 files changed, 97 insertions(+), 31 deletions(-)
>>>  create mode 100644 libsanitizer/ChangeLog.asan
>>>
>>> 2012-11-22  H.J. Lu  <hongjiu...@intel.com>
>>>
>>>         * Makefile.am (AM_MAKEFLAGS): Remove CC and CXX.
>>>         * configure.ac (ACX_NONCANONICAL_TARGET): New.
>>>         * asan/Makefile.am (AM_CXXFLAGS): Add -I for libstdc++-v3 header
>>>         files.
>>>         (AM_MAKEFLAGS): Remove CC and CXX.
>>>         * interception/Makefile.am: Likewise.
>>>         * sanitizer_common/Makefile.am: Likewise.
>>>         * tsan/Makefile.am: Likewise.
>>>         * Makefile.in: Regenerated.
>>>         * aclocal.m4: Likewise.
>>>         * configure: Likewise.
>>>         * asan/Makefile.in: Likewise.
>>>         * interception/Makefile.in: Likewise.
>>>         * sanitizer_common/Makefile.in: Likewise.
>>>         * tsan/Makefile.in: Likewise.
>>>
>>> diff --git a/libsanitizer/Makefile.am b/libsanitizer/Makefile.am
>>> index 64d3d2e..cd4e92d 100644
>>> --- a/libsanitizer/Makefile.am
>>> +++ b/libsanitizer/Makefile.am
>>> @@ -37,8 +37,6 @@ AM_MAKEFLAGS = \
>>>         "includedir=$(includedir)" \
>>>         "AR=$(AR)" \
>>>         "AS=$(AS)" \
>>> -       "CC=$(CC)" \
>>> -       "CXX=$(CXX)" \
>>>         "LD=$(LD)" \
>>>         "LIBCFLAGS=$(LIBCFLAGS)" \
>>>         "NM=$(NM)" \

As a followup please check if AM_MAKEFLAGS is needed at all.

>>> diff --git a/libsanitizer/Makefile.in b/libsanitizer/Makefile.in
>>> index 21c2711..53e0be9 100644
>>> --- a/libsanitizer/Makefile.in
>>> +++ b/libsanitizer/Makefile.in

Please do not include regenerated files in the patch.

>>> diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
>>> index 3da1db3..45fb3b3 100644
>>> --- a/libsanitizer/asan/Makefile.am
>>> +++ b/libsanitizer/asan/Makefile.am
>>> @@ -5,6 +5,10 @@ gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
>>>
>>>  DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS 
>>> -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DASAN_HAS_EXCEPTIONS=1 
>>> -DASAN_FLEXIBLE_MAPPING_AND_OFFSET=0 -DASAN_NEEDS_SEGV=1
>>>  AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic 
>>> -Wno-long-long  -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer 
>>> -funwind-tables -fvisibility=hidden -Wno-variadic-macros -Wno-c99-extensions
>>> +## We require libstdc++-v3 to be in the same build tree.
>>> +AM_CXXFLAGS += -I../../libstdc++-v3/include \
>>> +              -I../../libstdc++-v3/include/$(target_noncanonical) \
>>> +              -I$(srcdir)/../../libstdc++-v3/libsupc++

As a followup, please bring back the possibility to build libsanitizer
standalone, also wrapping the chooice of flags to link to libstdc++-v3
in a new config/libstdc++-raw-cxx.m4 file.

Bonus points for using this macro elsewhere in the tree.

>>>  ACLOCAL_AMFLAGS = -I $(top_srcdir) -I $(top_srcdir)/config
>>>
>>>  toolexeclib_LTLIBRARIES = libasan.la
>>> @@ -64,8 +68,6 @@ AM_MAKEFLAGS = \
>>>         "includedir=$(includedir)" \
>>>         "AR=$(AR)" \
>>>         "AS=$(AS)" \
>>> -       "CC=$(CC)" \
>>> -       "CXX=$(CXX)" \
>>>         "LD=$(LD)" \
>>>         "LIBCFLAGS=$(LIBCFLAGS)" \
>>>         "NM=$(NM)" \

Same as above, and same for other .am files.


>>> diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
>>> index 2d62ec4..9c73904 100644
>>> --- a/libsanitizer/configure.ac
>>> +++ b/libsanitizer/configure.ac
>>> @@ -19,6 +19,7 @@ AC_MSG_RESULT($version_specific_libs)
>>>  # Do not delete or change the following two lines.  For why, see
>>>  # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
>>>  AC_CANONICAL_SYSTEM
>>> +ACX_NONCANONICAL_TARGET

Note that if you create a new macro, ACX_NONCANONICAL_TARGET should be
AC_REQUIREd there.

Paolo

Reply via email to