* [gccgo] Use -static-libstdc++ when building the Go compiler
@ 2009-11-21 0:04 Ian Lance Taylor
2009-11-21 0:54 ` Joseph S. Myers
0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-11-21 0:04 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]
When bootstrapping gccgo, the Go compiler winds up being built with
the current version of libstdc++. That makes it a pain to run if the
current version of libstdc++ is newer than the system version.
Fortunately I introduced the -static-libstdc++ option to avoid just
this issue for the build-with-cxx branch. This patch uses the option,
if it is supported, when building the Go compiler. Committed to gccgo
branch.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: -static-libstdc++ --]
[-- Type: text/x-diff, Size: 1730 bytes --]
Index: go/Make-lang.in
===================================================================
--- go/Make-lang.in (revision 154350)
+++ go/Make-lang.in (working copy)
@@ -66,7 +66,7 @@ GO_OBJS = \
go/unsafe.o
go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
- $(CXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
+ $(CXX) $(STATIC_LIBSTDCXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
$(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
# Build hooks.
Index: configure.ac
===================================================================
--- configure.ac (revision 154350)
+++ configure.ac (working copy)
@@ -4118,6 +4118,22 @@ done
# UNSORTED
# --------
+# Test whether $CXX supports -static-libstdc++
+AC_CACHE_CHECK([whether $CXX supports -static-libstdc++],
+ gcc_cv_cxx_supports_static_libstdcxx,
+ [if $CXX -static-libstdc++ >/dev/null 2>&1 |
+ grep 'unrecognized option' >/dev/null; then
+ gcc_cv_cxx_supports_static_libstdcxx=no
+ else
+ gcc_cv_cxx_supports_static_libstdcxx=yes
+ fi])
+if test "$gcc_cv_cxx_supports_static_libstdcxx" = yes; then
+ STATIC_LIBSTDCXX=-static-libstdc++
+else
+ STATIC_LIBSTDCXX=
+fi
+AC_SUBST(STATIC_LIBSTDCXX)
+
# Create .gdbinit.
echo "dir ." > .gdbinit
Index: Makefile.in
===================================================================
--- Makefile.in (revision 154350)
+++ Makefile.in (working copy)
@@ -220,6 +220,10 @@ LINKER = $(CXX)
LINKER_FLAGS = $(CXXFLAGS)
endif
+# This is set by the configure script to be -static-libstdc++ if
+# $(CXX) supports the option.
+STATIC_LIBSTDCXX = @STATIC_LIBSTDCXX@
+
# -------------------------------------------
# Programs which operate on the build machine
# -------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gccgo] Use -static-libstdc++ when building the Go compiler
2009-11-21 0:04 [gccgo] Use -static-libstdc++ when building the Go compiler Ian Lance Taylor
@ 2009-11-21 0:54 ` Joseph S. Myers
2009-11-21 1:54 ` Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler) Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Joseph S. Myers @ 2009-11-21 0:54 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc-patches
On Fri, 20 Nov 2009, Ian Lance Taylor wrote:
> When bootstrapping gccgo, the Go compiler winds up being built with
> the current version of libstdc++. That makes it a pain to run if the
> current version of libstdc++ is newer than the system version.
> Fortunately I introduced the -static-libstdc++ option to avoid just
> this issue for the build-with-cxx branch. This patch uses the option,
> if it is supported, when building the Go compiler. Committed to gccgo
> branch.
This should not override --with-host-libstdcxx (and my previous comments
<http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01719.html> that C++ code
should be linked with $(CC) in non-bootstrapped builds with
--with-host-libstdcxx apply equally here as they do to building the whole
compiler as C++ - i.e. things to get right before merging the Go compiler
to trunk, or building the whole compiler as C++ by default).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler)
2009-11-21 0:54 ` Joseph S. Myers
@ 2009-11-21 1:54 ` Ian Lance Taylor
2009-11-21 2:46 ` DJ Delorie
0 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-11-21 1:54 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: gcc-patches
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> On Fri, 20 Nov 2009, Ian Lance Taylor wrote:
>
>> When bootstrapping gccgo, the Go compiler winds up being built with
>> the current version of libstdc++. That makes it a pain to run if the
>> current version of libstdc++ is newer than the system version.
>> Fortunately I introduced the -static-libstdc++ option to avoid just
>> this issue for the build-with-cxx branch. This patch uses the option,
>> if it is supported, when building the Go compiler. Committed to gccgo
>> branch.
>
> This should not override --with-host-libstdcxx (and my previous comments
> <http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01719.html> that C++ code
> should be linked with $(CC) in non-bootstrapped builds with
> --with-host-libstdcxx apply equally here as they do to building the whole
> compiler as C++ - i.e. things to get right before merging the Go compiler
> to trunk, or building the whole compiler as C++ by default).
Speaking of your previous comments, I don't think anybody ever
reviewed
http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01930.html
So: ping.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler)
2009-11-21 1:54 ` Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler) Ian Lance Taylor
@ 2009-11-21 2:46 ` DJ Delorie
2009-11-21 9:44 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: DJ Delorie @ 2009-11-21 2:46 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: joseph, gcc-patches
> http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01930.html
>
> So: ping.
Looks OK to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler)
2009-11-21 2:46 ` DJ Delorie
@ 2009-11-21 9:44 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2009-11-21 9:44 UTC (permalink / raw)
To: gcc-patches
On 11/21/2009 02:53 AM, DJ Delorie wrote:
>> http://gcc.gnu.org/ml/gcc-patches/2009-06/msg01930.html
>>
>> So: ping.
>
> Looks OK to me.
Also looks OK to me, though I'm not sure if here:
+LINKER = $(CC)
+LINKER_FLAGS = $(CFLAGS)
you want $(CFLAGS) or $(CXXFLAGS) since you're using $(CC) only to avoid
introducing -lstdc++. But with DJ's approval you can commit it either way.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-21 9:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-21 0:04 [gccgo] Use -static-libstdc++ when building the Go compiler Ian Lance Taylor
2009-11-21 0:54 ` Joseph S. Myers
2009-11-21 1:54 ` Top-level build machinery patch ping (Was: Re: [gccgo] Use -static-libstdc++ when building the Go compiler) Ian Lance Taylor
2009-11-21 2:46 ` DJ Delorie
2009-11-21 9:44 ` Paolo Bonzini
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).