public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
@ 2011-10-28 18:44 Iain Sandoe
  2011-11-07 11:42 ` PING 1 " Iain Sandoe
  0 siblings, 1 reply; 6+ messages in thread
From: Iain Sandoe @ 2011-10-28 18:44 UTC (permalink / raw)
  To: GCC Patches; +Cc: Arnaud Charlet, Thomas Quinot

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

The sizes of items represented in s-oscons.ads can (and do) change  
with the multi-lib on targets that support  libada as a multi-lib.

At present, s-oscons.ads is only built once (in gcc/ada) and sym- 
linked to rts*/

This is causing a bunch of failures on i686-darwin9 where the m64  
multi-lib has generally larger structures than the m32 native.

On m64 targets with m32 multi-libs, this tends to be hidden by the  
fact that (generally) the m32 entities are smaller than their m64  
counterparts.  However, it's still wrong (at least insofar as wasting  
memory - if not on any more serious scale).

The attached patch moves the generation and use of the xoscons tool to  
the the library makefile (as suggested by Thomas) and adjusts the  
libada/Makefile dependency to point to this tool.  The remaining  
dependencies should (AFAICT) be handled by the gnatlib target - which  
thence depends on the required objects.

I don't have that many targets to test - and would very much welcome  
any more-Ada-build-system-aware  eyes cast over this.

This DTRT on i686-darwin9 (no unexpected fails at m64 when it's  
applied).

OK for trunk ?
what about 4.6 - given that this is a wrong code scenario?

cheers
Iain


ada:

	* gcc-interface/Makefile.in (stamp-gnatlib-$(RTSDIR)): Don't
	link s-oscons.ads.
	(OSCONS_CPP, OSCONS_EXTRACT): New.
	(./bldtools/oscons/xoscons): New Target.
	($(RTSDIR)/s-oscons.ads): New Target.
	(gnatlib): Depend on  $(RTSDIR)/s-oscons.ads.
	* gcc-interface/Make-lang.in (ada/s-oscons.ads) Remove as dependency.
	* Make-generated.in: Remove machinery to generate xoscons and
	ada/s-oscons.ads.

libada:

	Makefile.in: Change dependency on oscons to depend on the generator
	tool.


[-- Attachment #2: 180619-libada-oscons-diff.txt --]
[-- Type: text/plain, Size: 7183 bytes --]

Index: gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc/ada/gcc-interface/Makefile.in	(revision 180619)
+++ gcc/ada/gcc-interface/Makefile.in	(working copy)
@@ -2498,21 +2498,50 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
 	                $(RTSDIR)/$(word 1,$(subst <, ,$(PAIR)));)
 # Copy tsystem.h
 	$(CP) $(srcdir)/tsystem.h $(RTSDIR)
-# Copy generated target dependent sources
-	$(RM) $(RTSDIR)/s-oscons.ads
-	(cd $(RTSDIR); $(LN_S) ../s-oscons.ads s-oscons.ads)
 	$(RM) ../stamp-gnatlib-$(RTSDIR)
 	touch ../stamp-gnatlib1-$(RTSDIR)
 
 # GNULLI End #############################################################
 
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
+OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
+             -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c
+
+OSCONS_EXTRACT=../../$(DECC) -DNATIVE \
+                 -DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c ; \
+  ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
+  ./s-oscons-tmplt.exe > s-oscons-tmplt.s
+
+else
+# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
+# for running it from $(RTSDIR)
+OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
+  | sed -e 's^\./xgcc^../../xgcc^' -e 's^-B./^-B../../^'`
+OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
+  -DTARGET=\"$(target)\" $(fsrcpfx)ada/s-oscons-tmplt.c > s-oscons-tmplt.i
+OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
+endif
+
+./bldtools/oscons/xoscons: xoscons.adb xutil.ads xutil.adb
+	-$(MKDIR) ./bldtools/oscons
+	$(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
+	$(CP) $^ ./bldtools/oscons
+	(cd ./bldtools/oscons ; gnatmake -q xoscons)
+
+$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
+	$(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
+	(cd $(RTSDIR) ; \
+	    $(OSCONS_CPP) ; \
+	    $(OSCONS_EXTRACT) ; \
+	    ../bldtools/oscons/xoscons)
+
 # Don't use semicolon separated shell commands that involve list expansions.
 # The semicolon triggers a call to DCL on VMS and DCL can't handle command
 # line lengths in excess of 256 characters.
 # Example: cd $(RTSDIR); ar rc libfoo.a $(LONG_LIST_OF_OBJS)
 # is guaranteed to overflow the buffer.
 
-gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
+gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR) $(RTSDIR)/s-oscons.ads
 	$(MAKE) -C $(RTSDIR) \
 		CC="`echo \"$(GCC_FOR_TARGET)\" \
 		| sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
Index: gcc/ada/gcc-interface/Make-lang.in
===================================================================
--- gcc/ada/gcc-interface/Make-lang.in	(revision 180619)
+++ gcc/ada/gcc-interface/Make-lang.in	(working copy)
@@ -568,7 +568,7 @@ canadian-gnattools: force
 	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools1-re
 	$(MAKE) -C ada $(ADA_TOOLS_FLAGS_TO_PASS) gnattools2
 
-gnatlib gnatlib-sjlj gnatlib-zcx gnatlib-shared: ada/s-oscons.ads force
+gnatlib gnatlib-sjlj gnatlib-zcx gnatlib-shared: force
 	$(MAKE) -C ada $(COMMON_FLAGS_TO_PASS)  \
 	   GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 	   GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
Index: gcc/ada/Make-generated.in
===================================================================
--- gcc/ada/Make-generated.in	(revision 180619)
+++ gcc/ada/Make-generated.in	(working copy)
@@ -64,37 +64,6 @@ $(ADA_GEN_SUBDIR)/nmake.ads :  $(ADA_GEN_SUBDIR)/s
 	$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake_s
 	(cd $(ADA_GEN_SUBDIR)/bldtools/nmake_s; gnatmake -q xnmake ; ./xnmake -s ../../nmake.ads )
 
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
-OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
-             -DTARGET='""$(target)""' s-oscons-tmplt.c
-
-OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
-                 -DTARGET='""$(target)""' s-oscons-tmplt.c ; \
-  ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
-  ./s-oscons-tmplt.exe > s-oscons-tmplt.s
-
-else
-# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
-# for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons
-OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
-  | sed -e 's^\./xgcc^../../../xgcc^' -e 's^-B./^-B../../../^'`
-OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
-  -DTARGET=\"$(target)\" s-oscons-tmplt.c > s-oscons-tmplt.i
-OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
-endif
-
-$(ADA_GEN_SUBDIR)/s-oscons.ads : $(ADA_GEN_SUBDIR)/s-oscons-tmplt.c $(ADA_GEN_SUBDIR)/gsocket.h $(ADA_GEN_SUBDIR)/xoscons.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
-	-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/oscons
-	$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/oscons/,$(notdir $^))
-	$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/oscons
-	(cd $(ADA_GEN_SUBDIR)/bldtools/oscons ; gnatmake -q xoscons ; \
-		$(RM) s-oscons-tmplt.i s-oscons-tmplt.s ; \
-		$(OSCONS_CPP) ; \
-		$(OSCONS_EXTRACT) ; \
-		./xoscons ; \
-		$(RM) ../../s-oscons.ads ; \
-		$(CP) s-oscons.ads s-oscons.h ../../)
-
 $(ADA_GEN_SUBDIR)/sdefault.adb: $(ADA_GEN_SUBDIR)/stamp-sdefault ; @true
 $(ADA_GEN_SUBDIR)/stamp-sdefault : $(srcdir)/version.c Makefile
 	$(ECHO) "pragma Style_Checks (Off);" >tmp-sdefault.adb
Index: libada/Makefile.in
===================================================================
--- libada/Makefile.in	(revision 180619)
+++ libada/Makefile.in	(working copy)
@@ -64,6 +64,7 @@ target_noncanonical:=@target_noncanonical@
 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
 libsubdir := $(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)
 ADA_RTS_DIR=$(GCC_DIR)/ada/rts$(subst /,_,$(MULTISUBDIR))
+ADA_RTS_SUBDIR=./rts$(subst /,_,$(MULTISUBDIR))
 
 # exeext should not be used because it's the *host* exeext.  We're building
 # a *target* library, aren't we?!?  Likewise for CC.  Still, provide bogus
@@ -90,10 +91,10 @@ LIBADA_FLAGS_TO_PASS = \
         "CFLAGS=$(CFLAGS)"
 
 # Rules to build gnatlib.
-.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared oscons
+.PHONY: gnatlib gnatlib-plain gnatlib-sjlj gnatlib-zcx gnatlib-shared osconstool
 gnatlib: @default_gnatlib_target@
 
-gnatlib-plain: oscons $(GCC_DIR)/ada/Makefile
+gnatlib-plain: osconstool $(GCC_DIR)/ada/Makefile
 	test -f stamp-libada || \
 	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) gnatlib \
 	&& touch stamp-libada
@@ -102,7 +103,7 @@ gnatlib: @default_gnatlib_target@
 	$(LN_S) $(ADA_RTS_DIR) adainclude
 	$(LN_S) $(ADA_RTS_DIR) adalib
 
-gnatlib-sjlj gnatlib-zcx gnatlib-shared: oscons $(GCC_DIR)/ada/Makefile
+gnatlib-sjlj gnatlib-zcx gnatlib-shared: osconstool $(GCC_DIR)/ada/Makefile
 	test -f stamp-libada || \
 	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) $@ \
 	&& touch stamp-libada
@@ -111,8 +112,8 @@ gnatlib: @default_gnatlib_target@
 	$(LN_S) $(ADA_RTS_DIR) adainclude
 	$(LN_S) $(ADA_RTS_DIR) adalib
 
-oscons:
-	$(MAKE) -C $(GCC_DIR) $(LIBADA_FLAGS_TO_PASS) ada/s-oscons.ads
+osconstool:
+	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) ./bldtools/oscons/xoscons
 
 install-gnatlib: $(GCC_DIR)/ada/Makefile
 	$(MAKE) -C $(GCC_DIR)/ada $(LIBADA_FLAGS_TO_PASS) install-gnatlib

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



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

* PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
  2011-10-28 18:44 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads Iain Sandoe
@ 2011-11-07 11:42 ` Iain Sandoe
  2011-11-09 10:49   ` Thomas Quinot
  0 siblings, 1 reply; 6+ messages in thread
From: Iain Sandoe @ 2011-11-07 11:42 UTC (permalink / raw)
  To: GCC Patches; +Cc: Arnaud Charlet, Thomas Quinot


On 28 Oct 2011, at 19:01, Iain Sandoe wrote:

> The sizes of items represented in s-oscons.ads can (and do) change  
> with the multi-lib on targets that support  libada as a multi-lib.
>
> At present, s-oscons.ads is only built once (in gcc/ada) and sym- 
> linked to rts*/
>
> This is causing a bunch of failures on i686-darwin9 where the m64  
> multi-lib has generally larger structures than the m32 native.
>
> On m64 targets with m32 multi-libs, this tends to be hidden by the  
> fact that (generally) the m32 entities are smaller than their m64  
> counterparts.  However, it's still wrong (at least insofar as  
> wasting memory - if not on any more serious scale).
>
> The attached patch moves the generation and use of the xoscons tool  
> to the the library makefile (as suggested by Thomas) and adjusts the  
> libada/Makefile dependency to point to this tool.  The remaining  
> dependencies should (AFAICT) be handled by the gnatlib target -  
> which thence depends on the required objects.
>
> I don't have that many targets to test - and would very much welcome  
> any more-Ada-build-system-aware  eyes cast over this.
>
> This DTRT on i686-darwin9 (no unexpected fails at m64 when it's  
> applied).

http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02695.html

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

* Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
  2011-11-07 11:42 ` PING 1 " Iain Sandoe
@ 2011-11-09 10:49   ` Thomas Quinot
  2011-11-09 11:49     ` Arnaud Charlet
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Quinot @ 2011-11-09 10:49 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Patches, Arnaud Charlet

* Iain Sandoe, 2011-11-07 :

> Subject: PING 1 [Patch Ada RFA] make sure that multilibs are built with
>  correct s-oscons.ads

Patch looks fine to me.

-- 
Thomas Quinot, Ph.D. ** quinot@adacore.com ** Senior Software Engineer
               AdaCore -- Paris, France -- New York, USA

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

* Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
  2011-11-09 10:49   ` Thomas Quinot
@ 2011-11-09 11:49     ` Arnaud Charlet
  2011-11-12 16:46       ` Iain Sandoe
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaud Charlet @ 2011-11-09 11:49 UTC (permalink / raw)
  To: Thomas Quinot; +Cc: Iain Sandoe, GCC Patches, Arnaud Charlet

> * Iain Sandoe, 2011-11-07 :
> 
> > Subject: PING 1 [Patch Ada RFA] make sure that multilibs are built with
> >  correct s-oscons.ads
> 
> Patch looks fine to me.

It's an official 'OK' then.

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

* Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
  2011-11-09 11:49     ` Arnaud Charlet
@ 2011-11-12 16:46       ` Iain Sandoe
  2011-11-12 17:33         ` Arnaud Charlet
  0 siblings, 1 reply; 6+ messages in thread
From: Iain Sandoe @ 2011-11-12 16:46 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: Thomas Quinot, GCC Patches


On 9 Nov 2011, at 09:54, Arnaud Charlet wrote:

>> * Iain Sandoe, 2011-11-07 :
>>
>>> Subject: PING 1 [Patch Ada RFA] make sure that multilibs are built  
>>> with
>>> correct s-oscons.ads
>>
>> Patch looks fine to me.
>
> It's an official 'OK' then.

Thanks, done (r181319).

May I repeat my question re. 4.6?
Since this is a wrong-code situation, I would have thought it eligible  
for a back-port?

thanks
Iain


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

* Re: PING 1 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads
  2011-11-12 16:46       ` Iain Sandoe
@ 2011-11-12 17:33         ` Arnaud Charlet
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaud Charlet @ 2011-11-12 17:33 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: Thomas Quinot, GCC Patches

> May I repeat my question re. 4.6?
> Since this is a wrong-code situation, I would have thought it eligible for
> a back-port?

Well, it's not a wrong-code as in "wrong code generated by the back-end",
and it's not a regression.

In any case, backporting to 4.6 is fine with me.

Arno

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

end of thread, other threads:[~2011-11-12 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-28 18:44 [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads Iain Sandoe
2011-11-07 11:42 ` PING 1 " Iain Sandoe
2011-11-09 10:49   ` Thomas Quinot
2011-11-09 11:49     ` Arnaud Charlet
2011-11-12 16:46       ` Iain Sandoe
2011-11-12 17:33         ` Arnaud Charlet

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