public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
@ 2013-08-25 22:55 Gabriel Dos Reis
  2013-08-30 10:15 ` Rainer Orth
  2013-08-31 21:42 ` Eric Botcazou
  0 siblings, 2 replies; 7+ messages in thread
From: Gabriel Dos Reis @ 2013-08-25 22:55 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches


Hi,

My earlier patch that formally desclared pretty_printer as polymorphic
uncovered a latent bug in the existing build machinery of the Ada
component.  It had been using xgcc to link against C++ source files.  It
should use xg++ instead.

This patch fixes that by introducing GXX_LINK which is GCC_LINK except
that CXX (e.g. xg++) instead of CC (e.g. xgcc) is invoked.

Eric, are there other executables that need to be linked with GXX_LINK
too but aren't triggered yet? 

Thanks,

-- Gaby

ada/
2013-08-25  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* gcc-interface/Makefile.in (GXX_LINK): New.  Same as GCC_LINK but
	with xgcc replaced with xgcc.
	(common-tools): Use it.
	(../../gnatmake$(exeext)): Likewise.
	(../../gnatlink$(exeext)): Likewise.

Index: ada/gcc-interface/Makefile.in
===================================================================
--- ada/gcc-interface/Makefile.in	(revision 201977)
+++ ada/gcc-interface/Makefile.in	(working copy)
@@ -2398,6 +2398,7 @@
 	"GNATBIND=$(GNATBIND)"
 
 GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)
+GXX_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)
 
 # Build directory for the tools. Let's copy the target-dependent
 # sources using the same mechanism as for gnatlib. The other sources are
@@ -2462,23 +2463,23 @@
 	  gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
 	  gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS)
 	$(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 	$(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+		--GCC="$(GXX_LINK)" $(TOOLS_LIBS)
 
 ../../gnatsym$(exeext): ../stamp-tools
 	$(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
@@ -2519,11 +2520,11 @@
 
 # Likewise for the tools
 ../../gnatmake$(exeext): $(P) b_gnatm.o $(GNATMAKE_OBJS)
-	+$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
+	+$(GXX_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
 		    $(TOOLS_LIBS)
 
 ../../gnatlink$(exeext): $(P) b_gnatl.o $(GNATLINK_OBJS)
-	+$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
+	+$(GXX_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
 		    $(TOOLS_LIBS)
 
 ../stamp-gnatlib-$(RTSDIR):

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-08-25 22:55 Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc Gabriel Dos Reis
@ 2013-08-30 10:15 ` Rainer Orth
  2013-08-31 21:42 ` Eric Botcazou
  1 sibling, 0 replies; 7+ messages in thread
From: Rainer Orth @ 2013-08-30 10:15 UTC (permalink / raw)
  To: Gabriel Dos Reis; +Cc: Eric Botcazou, gcc-patches

Gabriel Dos Reis <gdr@axiomatics.org> writes:

> My earlier patch that formally desclared pretty_printer as polymorphic
> uncovered a latent bug in the existing build machinery of the Ada
> component.  It had been using xgcc to link against C++ source files.  It
> should use xg++ instead.
>
> This patch fixes that by introducing GXX_LINK which is GCC_LINK except
> that CXX (e.g. xg++) instead of CC (e.g. xgcc) is invoked.
>
> Eric, are there other executables that need to be linked with GXX_LINK
> too but aren't triggered yet? 

It would be good to have this patch approved and committed: right now,
Ada bootstrap is broken without it.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-08-25 22:55 Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc Gabriel Dos Reis
  2013-08-30 10:15 ` Rainer Orth
@ 2013-08-31 21:42 ` Eric Botcazou
  2013-08-31 21:46   ` Gabriel Dos Reis
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2013-08-31 21:42 UTC (permalink / raw)
  To: Gabriel Dos Reis; +Cc: gcc-patches

> This patch fixes that by introducing GXX_LINK which is GCC_LINK except
> that CXX (e.g. xg++) instead of CC (e.g. xgcc) is invoked.
> 
> Eric, are there other executables that need to be linked with GXX_LINK
> too but aren't triggered yet?

Yes, all not covered executables linking with TOOLS_LIBS since it contains 
libcommon.a which now drags the C++ library.  So the simplest solution is to 
change GCC_LINK (there is one potential problematic case, vxaddr2line, but it 
probably didn't link before so let's forget it for now).

I'll attach a patch to the PR so that the Darwin folks can test it.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-08-31 21:42 ` Eric Botcazou
@ 2013-08-31 21:46   ` Gabriel Dos Reis
  2013-09-01  9:31     ` Iain Sandoe
  0 siblings, 1 reply; 7+ messages in thread
From: Gabriel Dos Reis @ 2013-08-31 21:46 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

Eric Botcazou <ebotcazou@adacore.com> writes:

| > This patch fixes that by introducing GXX_LINK which is GCC_LINK except
| > that CXX (e.g. xg++) instead of CC (e.g. xgcc) is invoked.
| > 
| > Eric, are there other executables that need to be linked with GXX_LINK
| > too but aren't triggered yet?
| 
| Yes, all not covered executables linking with TOOLS_LIBS since it contains 
| libcommon.a which now drags the C++ library.  So the simplest solution is to 
| change GCC_LINK (there is one potential problematic case, vxaddr2line, but it 
| probably didn't link before so let's forget it for now).
| 
| I'll attach a patch to the PR so that the Darwin folks can test it.

Thank you; that is very much appreciated.

-- Gaby

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-08-31 21:46   ` Gabriel Dos Reis
@ 2013-09-01  9:31     ` Iain Sandoe
  2013-09-01 16:52       ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Iain Sandoe @ 2013-09-01  9:31 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: GCC Patches, Gabriel Dos Reis


On 31 Aug 2013, at 22:42, Gabriel Dos Reis wrote:

> Eric Botcazou <ebotcazou@adacore.com> writes:
> 
> | > This patch fixes that by introducing GXX_LINK which is GCC_LINK except
> | > that CXX (e.g. xg++) instead of CC (e.g. xgcc) is invoked.
> | > 
> | > Eric, are there other executables that need to be linked with GXX_LINK
> | > too but aren't triggered yet?
> | 
> | Yes, all not covered executables linking with TOOLS_LIBS since it contains 
> | libcommon.a which now drags the C++ library.  So the simplest solution is to 
> | change GCC_LINK (there is one potential problematic case, vxaddr2line, but it 
> | probably didn't link before so let's forget it for now).
> | 
> | I'll attach a patch to the PR so that the Darwin folks can test it.
> 
> Thank you; that is very much appreciated.

yes, indeed, thanks Eric,
It seems the patch needs a couple of minor amendments to work with Darwin - and I've added an updated version to the PR which passes bootstrap and make check-ada on x86_64-darwin12.
Iain

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-09-01  9:31     ` Iain Sandoe
@ 2013-09-01 16:52       ` Eric Botcazou
  2013-09-01 17:11         ` Gabriel Dos Reis
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2013-09-01 16:52 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: gcc-patches, Gabriel Dos Reis

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

> It seems the patch needs a couple of minor amendments to work with Darwin -
> and I've added an updated version to the PR which passes bootstrap and make
> check-ada on x86_64-darwin12. Iain

Thanks, here is the final patch I just installed.


2013-09-01  Eric Botcazou  <ebotcazou@adacore.com>
            Iain Sandoe  <iain@codesourcery.com>

	PR ada/58239
gnattools/
	* Makefile.in (CXX_LFLAGS): New.
	(TOOLS_FLAGS_TO_PASS_NATIVE): Pass CXX and CXX_LFLAGS.
	(TOOLS_FLAGS_TO_PASS_RE): Likewise.
	(TOOLS_FLAGS_TO_PASS_CROSS): Pass CXX.
gcc/ada/
	* gcc-interface/Makefile.in (GCC_LINK_FLAGS): Add -static-libstdc++.
	(GCC_LINK): Use CXX instead of CC.
	* gcc-interface/Make-lang.in (CXX_LFLAGS): New.
	(ADA_TOOLS_FLAGS_TO_PASS): Pass CXX, and CXX_LFLAGS for native.


-- 
Eric Botcazou

[-- Attachment #2: pr58239.diff --]
[-- Type: text/x-patch, Size: 4401 bytes --]

Index: gnattools/Makefile.in
===================================================================
--- gnattools/Makefile.in	(revision 202141)
+++ gnattools/Makefile.in	(working copy)
@@ -63,9 +63,16 @@ INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -
 	-I$(fsrcdir)/../include -I$(fsrcdir)
 ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada
 
+CXX_LFLAGS = \
+ -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
+ -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \
+ -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
+ -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs
+
 # Variables for gnattools, native
 TOOLS_FLAGS_TO_PASS_NATIVE= \
 	"CC=../../xgcc -B../../" \
+	"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
 	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
 	"LDFLAGS=$(LDFLAGS)" \
 	"ADAFLAGS=$(ADAFLAGS)" \
@@ -83,6 +90,7 @@ TOOLS_FLAGS_TO_PASS_NATIVE= \
 # Variables for regnattools
 TOOLS_FLAGS_TO_PASS_RE= \
 	"CC=../../xgcc -B../../" \
+	"CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \
 	"CFLAGS=$(CFLAGS)" \
 	"ADAFLAGS=$(ADAFLAGS)" \
 	"ADA_CFLAGS=$(ADA_CFLAGS)" \
@@ -99,6 +107,7 @@ TOOLS_FLAGS_TO_PASS_RE= \
 # Variables for gnattools, cross
 TOOLS_FLAGS_TO_PASS_CROSS= \
 	"CC=$(CC)" \
+	"CXX=$(CXX)" \
 	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
 	"LDFLAGS=$(LDFLAGS)" \
 	"ADAFLAGS=$(ADAFLAGS)"	\
Index: gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc/ada/gcc-interface/Makefile.in	(revision 202141)
+++ gcc/ada/gcc-interface/Makefile.in	(working copy)
@@ -198,7 +198,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
 # Link flags used to build gnat tools.  By default we prefer to statically
 # link with libgcc to avoid a dependency on shared libgcc (which is tricky
 # to deal with as it may conflict with the libgcc provided by the system).
-GCC_LINK_FLAGS=-static-libgcc
+GCC_LINK_FLAGS=-static-libstdc++ -static-libgcc
 
 # End of variables for you to override.
 
@@ -2275,7 +2275,7 @@ ifeq ($(strip $(filter-out darwin%,$(osy
   GMEM_LIB = gmemlib
   LIBRARY_VERSION := $(LIB_VERSION)
   soext = .dylib
-  GCC_LINK_FLAGS=
+  GCC_LINK_FLAGS=-static-libstdc++
 endif
 
 # ARM Nucleus
@@ -2397,7 +2397,7 @@ TOOLS_FLAGS_TO_PASS=		\
 	"GNATLINK=$(GNATLINK)"	\
 	"GNATBIND=$(GNATBIND)"
 
-GCC_LINK=$(CC) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)
+GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES)
 
 # Build directory for the tools. Let's copy the target-dependent
 # sources using the same mechanism as for gnatlib. The other sources are
Index: gcc/ada/gcc-interface/Make-lang.in
===================================================================
--- gcc/ada/gcc-interface/Make-lang.in	(revision 202141)
+++ gcc/ada/gcc-interface/Make-lang.in	(working copy)
@@ -111,6 +111,12 @@ ada: gnat1$(exeext) gnatbind$(exeext)
 # Tell GNU Make to ignore these, if they exist.
 .PHONY: ada
 
+CXX_LFLAGS = \
+ -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
+ -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \
+ -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \
+ -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs
+
 # There are too many Ada sources to check against here.  Let's
 # always force the recursive make.
 ifeq ($(build), $(host))
@@ -119,6 +125,7 @@ ifeq ($(build), $(host))
     # tree.
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="../../xgcc -B../../" \
+        CXX="../../xg++ -B../../ $(CXX_LFLAGS)" \
         $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
         ADA_INCLUDES="-I- -I../rts" \
         GNATMAKE="../../gnatmake" \
@@ -136,6 +143,7 @@ ifeq ($(build), $(host))
 
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="$(CC)" \
+        CXX="$(CXX)" \
         $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
         ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
         GNATMAKE="gnatmake" \
@@ -158,6 +166,7 @@ else
     # built runtime.
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="$(CC)" \
+        CXX="$(CXX)" \
         $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS)  \
         ADA_INCLUDES="-I../rts"                \
         GNATMAKE="$(GNATMAKE_FOR_HOST)"      \
@@ -172,6 +181,7 @@ else
     endif
     ADA_TOOLS_FLAGS_TO_PASS=\
         CC="$(CC)" \
+        CXX="$(CXX)" \
         $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS)  \
         ADA_INCLUDES="-I$(RTS_DIR)../adainclude -I$(RTS_DIR)" \
         GNATMAKE="$(GNATMAKE_FOR_HOST)"      \

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc
  2013-09-01 16:52       ` Eric Botcazou
@ 2013-09-01 17:11         ` Gabriel Dos Reis
  0 siblings, 0 replies; 7+ messages in thread
From: Gabriel Dos Reis @ 2013-09-01 17:11 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Iain Sandoe, gcc-patches

Eric Botcazou <ebotcazou@adacore.com> writes:

| > It seems the patch needs a couple of minor amendments to work with Darwin -
| > and I've added an updated version to the PR which passes bootstrap and make
| > check-ada on x86_64-darwin12. Iain
| 
| Thanks, here is the final patch I just installed.


Thanks!

-- Gaby

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-01 17:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-25 22:55 Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc Gabriel Dos Reis
2013-08-30 10:15 ` Rainer Orth
2013-08-31 21:42 ` Eric Botcazou
2013-08-31 21:46   ` Gabriel Dos Reis
2013-09-01  9:31     ` Iain Sandoe
2013-09-01 16:52       ` Eric Botcazou
2013-09-01 17:11         ` Gabriel Dos Reis

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