Patchwork Use libstdc++-raw-cxx.m4 in libjava

login
register
mail settings
Submitter H.J. Lu
Date Dec. 11, 2012, 10 p.m.
Message ID <CAMe9rOozsRTt6UAoucB6hbw4eKbhN5U5YZBSE0etB5Lj_emZfA@mail.gmail.com>
Download mbox | patch
Permalink /patch/205312/
State New
Headers show

Comments

H.J. Lu - Dec. 11, 2012, 10 p.m.
On Tue, Dec 11, 2012 at 6:36 AM, Paolo Bonzini <bonzini@gnu.org> wrote:

>>>>  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.
>

This patch adds LIBSTDCXX_RAW_CXX_LDFLAGS and use
it in libjava and libsanitizer which set raw_cxx=true.  I am testing
it on Linux/x86-64.  OK to install if it works?

Thanks.


H.J.
---
cat /tmp/gcc-raw-cxx.patch
config/

2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	* libstdc++-raw-cxx.m4 (GCC_LIBSTDCXX_RAW_CXX_FLAGS): Also
	AC_SUBST LIBSTDCXX_RAW_CXX_LDFLAGS.

libjava/

2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (lib_gnu_awt_xlib_la_CPPFLAGS): Use
	$(LIBSTDCXX_RAW_CXX_CXXLAGS).
	(lib_gnu_awt_xlib_la_LDFLAGS): Use $(LIBSTDCXX_RAW_CXX_LDLAGS).
	* configure.ac (GCC_LIBSTDCXX_RAW_CXX_FLAGS): New.
	* aclocal.m4: Regenerated.
	* Makefile.in:Likewise.
	* configure: Likewise.

libsanitizer/

2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>

	* asan/Makefile.am (libasan_la_LIBADD): Use $(LIBSTDCXX_RAW_CXX_LDLAGS).
	* tsan/Makefile.am (libtsan_la_LIBADD): Likewise.
	* Makefile.in: Regenerated.
	* configure: Likewise.
	* asan/Makefile.in: Likewise.
	* interception/Makefile.in: Likewise.
	* sanitizer_common/Makefile.in: Likewise.
	* tsan/Makefile.in: Likewise.

$(top_builddir)/sanitizer_common/libsanitizer_common.la
$(top_builddir)/interception/libinterception.la
$(LIBSTDCXX_RAW_CXX_LDLAGS)
 libtsan_la_LDFLAGS = -version-info `grep -v '^\#'
$(srcdir)/libtool-version` -lpthread -ldl

 MAKEOVERRIDES=
Paolo Bonzini - Dec. 12, 2012, 8:50 a.m.
Il 11/12/2012 23:00, H.J. Lu ha scritto:
>  ## The mysterious backslash in the grep pattern is consumed by make.
> -lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
> +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
>  	@X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
>          -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
>          -version-info `grep -v '^\#' $(srcdir)/libtool-version`

I'm not sure this comment about the mysterious backslash is actually
true.  Anyway, unrelated to this patch.

Ok for trunk, thanks.

Paolo
Jakub Jelinek - Jan. 2, 2013, 11:11 a.m.
On Tue, Dec 11, 2012 at 02:00:18PM -0800, H.J. Lu wrote:
> 2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* libstdc++-raw-cxx.m4 (GCC_LIBSTDCXX_RAW_CXX_FLAGS): Also
> 	AC_SUBST LIBSTDCXX_RAW_CXX_LDFLAGS.

> --- a/config/libstdc++-raw-cxx.m4
> +++ b/config/libstdc++-raw-cxx.m4
> @@ -14,13 +14,17 @@
>  # along with GCC; see the file COPYING3.  If not see
>  # <http://www.gnu.org/licenses/>.
> 
> -# Define compiler flags, LIBSTDCXX_RAW_CXX_CXXFLAGS, for libstdc++-v3
> -# header files to compile libraries in C++ with raw_cxx=true.
> +# Define flags, LIBSTDCXX_RAW_CXX_CXXFLAGS and # LIBSTDCXX_RAW_CXX_LDFLAGS,
> +# for libstdc++-v3 header files to compile and link libraries in C++ with
> +# raw_cxx=true.
>  AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [
>    AC_REQUIRE([ACX_NONCANONICAL_TARGET])
>    LIBSTDCXX_RAW_CXX_CXXFLAGS="\
>      -I\$(top_builddir)/../libstdc++-v3/include \
>      -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \
>      -I\$(top_srcdir)/../libstdc++-v3/libsupc++"
> +  LIBSTDCXX_RAW_CXX_LDFLAGS="\
> +    -I\$(top_builddir)/../libstdc++-v3/src/libstdc++.la"

-I..../libstdc++-v3/src/libstdc++.la ?  That can't be right, libstdc++.la
is not a directory containing header files.

	Jakub
Andreas Schwab - Jan. 2, 2013, 11:27 a.m.
Jakub Jelinek <jakub@redhat.com> writes:

> On Tue, Dec 11, 2012 at 02:00:18PM -0800, H.J. Lu wrote:
>> 2012-12-11  H.J. Lu  <hongjiu.lu@intel.com>
>> 
>> 	* libstdc++-raw-cxx.m4 (GCC_LIBSTDCXX_RAW_CXX_FLAGS): Also
>> 	AC_SUBST LIBSTDCXX_RAW_CXX_LDFLAGS.
>
>> --- a/config/libstdc++-raw-cxx.m4
>> +++ b/config/libstdc++-raw-cxx.m4
>> @@ -14,13 +14,17 @@
>>  # along with GCC; see the file COPYING3.  If not see
>>  # <http://www.gnu.org/licenses/>.
>> 
>> -# Define compiler flags, LIBSTDCXX_RAW_CXX_CXXFLAGS, for libstdc++-v3
>> -# header files to compile libraries in C++ with raw_cxx=true.
>> +# Define flags, LIBSTDCXX_RAW_CXX_CXXFLAGS and # LIBSTDCXX_RAW_CXX_LDFLAGS,
>> +# for libstdc++-v3 header files to compile and link libraries in C++ with
>> +# raw_cxx=true.
>>  AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [
>>    AC_REQUIRE([ACX_NONCANONICAL_TARGET])
>>    LIBSTDCXX_RAW_CXX_CXXFLAGS="\
>>      -I\$(top_builddir)/../libstdc++-v3/include \
>>      -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \
>>      -I\$(top_srcdir)/../libstdc++-v3/libsupc++"
>> +  LIBSTDCXX_RAW_CXX_LDFLAGS="\
>> +    -I\$(top_builddir)/../libstdc++-v3/src/libstdc++.la"
>
> -I..../libstdc++-v3/src/libstdc++.la ?  That can't be right, libstdc++.la
> is not a directory containing header files.

And a library shouldn't be put on LDFLAGS, but on LIBADD.  And
LIBSTDCXX_RAW_CXX_LDLAGS doesn't exist.

Andreas.

Patch

diff --git a/config/libstdc++-raw-cxx.m4 b/config/libstdc++-raw-cxx.m4
index 20124e3..8052c2f 100644
--- a/config/libstdc++-raw-cxx.m4
+++ b/config/libstdc++-raw-cxx.m4
@@ -14,13 +14,17 @@ 
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.

-# Define compiler flags, LIBSTDCXX_RAW_CXX_CXXFLAGS, for libstdc++-v3
-# header files to compile libraries in C++ with raw_cxx=true.
+# Define flags, LIBSTDCXX_RAW_CXX_CXXFLAGS and # LIBSTDCXX_RAW_CXX_LDFLAGS,
+# for libstdc++-v3 header files to compile and link libraries in C++ with
+# raw_cxx=true.
 AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [
   AC_REQUIRE([ACX_NONCANONICAL_TARGET])
   LIBSTDCXX_RAW_CXX_CXXFLAGS="\
     -I\$(top_builddir)/../libstdc++-v3/include \
     -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \
     -I\$(top_srcdir)/../libstdc++-v3/libsupc++"
+  LIBSTDCXX_RAW_CXX_LDFLAGS="\
+    -I\$(top_builddir)/../libstdc++-v3/src/libstdc++.la"
   AC_SUBST(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+  AC_SUBST(LIBSTDCXX_RAW_CXX_LDFLAGS)
 ])
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 1b71962..c6c84e4 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -590,14 +590,11 @@  lib_gnu_awt_xlib_la_DEPENDENCIES =
libgcj-$(gcc_version).jar \
 if BUILD_SUBLIBS
 lib_gnu_awt_xlib_la_DEPENDENCIES += libgcj-noncore.la
 endif
-## We require libstdc++-v3 to be in the same build tree.
 lib_gnu_awt_xlib_la_CPPFLAGS = \
 	$(AM_CPPFLAGS) \
-	-I../libstdc++-v3/include \
-	-I../libstdc++-v3/include/$(target_noncanonical) \
-	-I$(srcdir)/../libstdc++-v3/libsupc++
+	$(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 ## The mysterious backslash in the grep pattern is consumed by make.
-lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
+lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
 	@X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
         -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
         -version-info `grep -v '^\#' $(srcdir)/libtool-version`
$(LIBGCJ_LD_SYMBOLIC)
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 5fa75c6..ba6b363 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -24,6 +24,8 @@  _GCC_TOPLEV_NONCANONICAL_TARGET

 AC_SUBST(target_noncanonical)

+GCC_LIBSTDCXX_RAW_CXX_FLAGS
+
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
diff --git a/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 5852c35..95fd75e 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -36,10 +36,11 @@  asan_files = \
 libasan_la_SOURCES = $(asan_files)
 if USING_MAC_INTERPOSE
 libasan_la_SOURCES += dynamic/asan_interceptors_dynamic.cc
-libasan_la_LIBADD =
$(top_builddir)/sanitizer_common/libsanitizer_common.la
$(top_builddir)/../libstdc++-v3/src/libstdc++.la
+libasan_la_LIBADD = $(top_builddir)/sanitizer_common/libsanitizer_common.la
 else
-libasan_la_LIBADD =
$(top_builddir)/sanitizer_common/libsanitizer_common.la
$(top_builddir)/interception/libinterception.la
$(top_builddir)/../libstdc++-v3/src/libstdc++.la
+libasan_la_LIBADD =
$(top_builddir)/sanitizer_common/libsanitizer_common.la
$(top_builddir)/interception/libinterception.la
 endif
+libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDLAGS)

 libasan_la_LDFLAGS = -version-info `grep -v '^\#'
$(srcdir)/libtool-version` -lpthread -ldl

diff --git a/libsanitizer/tsan/Makefile.am b/libsanitizer/tsan/Makefile.am
index a4e3e51..a92ab34 100644
--- a/libsanitizer/tsan/Makefile.am
+++ b/libsanitizer/tsan/Makefile.am
@@ -34,7 +34,7 @@  tsan_files = \
         tsan_symbolize_addr2line_linux.cc

 libtsan_la_SOURCES = $(tsan_files)
-libtsan_la_LIBADD =
$(top_builddir)/sanitizer_common/libsanitizer_common.la
$(top_builddir)/interception/libinterception.la
$(top_builddir)/../libstdc++-v3/src/libstdc++.la
+libtsan_la_LIBADD =