Patchwork Ada PATCH: Fix ada/58239 by linking with xg++, not xgcc

login
register
mail settings
Submitter Gabriel Dos Reis
Date Aug. 25, 2013, 10:02 p.m.
Message ID <8761uttoo5.fsf@euclid.axiomatics.org>
Download mbox | patch
Permalink /patch/269723/
State New
Headers show

Comments

Gabriel Dos Reis - Aug. 25, 2013, 10:02 p.m.
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.
Rainer Orth - Aug. 30, 2013, 10:06 a.m.
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
Eric Botcazou - Aug. 31, 2013, 9 p.m.
> 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.
Gabriel Dos Reis - Aug. 31, 2013, 9:42 p.m.
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
Iain Sandoe - Sept. 1, 2013, 9:30 a.m.
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

Patch

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