diff mbox

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

Message ID CAMe9rOrvnf7oobhV8ukeS+7mn3Gn=8DqQFdfbkM+WLYYxx-Z+A@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Jan. 3, 2013, 5:18 p.m. UTC
On Wed, Jan 2, 2013 at 3:27 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> 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.
>

Here is the patch.  OK to install?

Thanks.

Comments

Andreas Schwab Jan. 3, 2013, 6:09 p.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> diff --git a/libjava/Makefile.am b/libjava/Makefile.am
> index c6c84e4..dd08a4f 100644
> --- a/libjava/Makefile.am
> +++ b/libjava/Makefile.am
> @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \
>  	$(AM_CPPFLAGS) \
>  	$(LIBSTDCXX_RAW_CXX_CXXFLAGS)
>  ## The mysterious backslash in the grep pattern is consumed by make.
> -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
> +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \
>  	@X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
>          -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
>          -version-info `grep -v '^\#' $(srcdir)/libtool-version`
> $(LIBGCJ_LD_SYMBOLIC)

It is still wrong to use LDFLAGS for libraries to be linked in.
All of $(LIBSTDCXX_RAW_CXX_LIBADD) @X_PRE_LIBS@ @X_LIBS@ -lX11
@X_EXTRA_LIBS@ should be on lib_gnu_awt_xlib_la_LDADD.

Andreas.
H.J. Lu Jan. 3, 2013, 6:46 p.m. UTC | #2
On Thu, Jan 3, 2013 at 10:09 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> diff --git a/libjava/Makefile.am b/libjava/Makefile.am
>> index c6c84e4..dd08a4f 100644
>> --- a/libjava/Makefile.am
>> +++ b/libjava/Makefile.am
>> @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \
>>       $(AM_CPPFLAGS) \
>>       $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
>>  ## The mysterious backslash in the grep pattern is consumed by make.
>> -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
>> +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \
>>       @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
>>          -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
>>          -version-info `grep -v '^\#' $(srcdir)/libtool-version`
>> $(LIBGCJ_LD_SYMBOLIC)
>
> It is still wrong to use LDFLAGS for libraries to be linked in.
> All of $(LIBSTDCXX_RAW_CXX_LIBADD) @X_PRE_LIBS@ @X_LIBS@ -lX11
> @X_EXTRA_LIBS@ should be on lib_gnu_awt_xlib_la_LDADD.
>

This was how it was done before my change.  If we want to
make a change, I can submit a separate patch.
Andreas Schwab Jan. 4, 2013, 10:06 a.m. UTC | #3
"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Thu, Jan 3, 2013 at 10:09 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>
>>> diff --git a/libjava/Makefile.am b/libjava/Makefile.am
>>> index c6c84e4..dd08a4f 100644
>>> --- a/libjava/Makefile.am
>>> +++ b/libjava/Makefile.am
>>> @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \
>>>       $(AM_CPPFLAGS) \
>>>       $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
>>>  ## The mysterious backslash in the grep pattern is consumed by make.
>>> -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
>>> +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \
>>>       @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
>>>          -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
>>>          -version-info `grep -v '^\#' $(srcdir)/libtool-version`
>>> $(LIBGCJ_LD_SYMBOLIC)
>>
>> It is still wrong to use LDFLAGS for libraries to be linked in.
>> All of $(LIBSTDCXX_RAW_CXX_LIBADD) @X_PRE_LIBS@ @X_LIBS@ -lX11
>> @X_EXTRA_LIBS@ should be on lib_gnu_awt_xlib_la_LDADD.
>>
>
> This was how it was done before my change.  If we want to
> make a change, I can submit a separate patch.

Libraries should never occur before the objects which reference them.

Andreas.
H.J. Lu Jan. 4, 2013, 2:56 p.m. UTC | #4
On Fri, Jan 4, 2013 at 2:06 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
>> On Thu, Jan 3, 2013 at 10:09 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>>
>>>> diff --git a/libjava/Makefile.am b/libjava/Makefile.am
>>>> index c6c84e4..dd08a4f 100644
>>>> --- a/libjava/Makefile.am
>>>> +++ b/libjava/Makefile.am
>>>> @@ -594,7 +594,7 @@ lib_gnu_awt_xlib_la_CPPFLAGS = \
>>>>       $(AM_CPPFLAGS) \
>>>>       $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
>>>>  ## The mysterious backslash in the grep pattern is consumed by make.
>>>> -lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
>>>> +lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \
>>>>       @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
>>>>          -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
>>>>          -version-info `grep -v '^\#' $(srcdir)/libtool-version`
>>>> $(LIBGCJ_LD_SYMBOLIC)
>>>
>>> It is still wrong to use LDFLAGS for libraries to be linked in.
>>> All of $(LIBSTDCXX_RAW_CXX_LIBADD) @X_PRE_LIBS@ @X_LIBS@ -lX11
>>> @X_EXTRA_LIBS@ should be on lib_gnu_awt_xlib_la_LDADD.
>>>
>>
>> This was how it was done before my change.  If we want to
>> make a change, I can submit a separate patch.
>
> Libraries should never occur before the objects which reference them.
>

This is in GCC 4.7:

lib_gnu_awt_xlib_la_LDFLAGS = ../libstdc++-v3/src/libstdc++.la \
        @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
        -rpath $(toolexeclibdir) $(LIBJAVA_LDFLAGS_NOUNDEF) \
        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
$(LIBGCJ_LD_SYMBOLIC)
lib_gnu_awt_xlib_la_LINK = $(LIBLINK) $(lib_gnu_awt_xlib_la_LDFLAGS) \
        $(lib_gnu_awt_xlib_la_version_arg)

It does put libraries first.  If it is a real bug, it should be fixed
separately.
diff mbox

Patch

diff --git a/config/libstdc++-raw-cxx.m4 b/config/libstdc++-raw-cxx.m4
index 8052c2f..d7aa1a9 100644
--- a/config/libstdc++-raw-cxx.m4
+++ b/config/libstdc++-raw-cxx.m4
@@ -23,8 +23,8 @@  AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [
     -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"
+  LIBSTDCXX_RAW_CXX_LIBADD="\
+    \$(top_builddir)/../libstdc++-v3/src/libstdc++.la"
   AC_SUBST(LIBSTDCXX_RAW_CXX_CXXFLAGS)
-  AC_SUBST(LIBSTDCXX_RAW_CXX_LDFLAGS)
+  AC_SUBST(LIBSTDCXX_RAW_CXX_LIBADD)
 ])
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index c6c84e4..dd08a4f 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -594,7 +594,7 @@  lib_gnu_awt_xlib_la_CPPFLAGS = \
 	$(AM_CPPFLAGS) \
 	$(LIBSTDCXX_RAW_CXX_CXXFLAGS)
 ## The mysterious backslash in the grep pattern is consumed by make.
-lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDLAGS) \
+lib_gnu_awt_xlib_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LIBADD) \
 	@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/libsanitizer/asan/Makefile.am b/libsanitizer/asan/Makefile.am
index 76cdcfd..b5a61ec 100644
--- a/libsanitizer/asan/Makefile.am
+++ b/libsanitizer/asan/Makefile.am
@@ -40,7 +40,7 @@  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
 endif
-libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LDLAGS)
+libasan_la_LIBADD += $(LIBSTDCXX_RAW_CXX_LIBADD)

 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 435fe71..62e339e 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
$(LIBSTDCXX_RAW_CXX_LDLAGS)
+libtsan_la_LIBADD =