From patchwork Fri Oct 28 18:01:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 122467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 266EEB6F70 for ; Sat, 29 Oct 2011 05:01:45 +1100 (EST) Received: (qmail 2458 invoked by alias); 28 Oct 2011 18:01:43 -0000 Received: (qmail 2441 invoked by uid 22791); 28 Oct 2011 18:01:41 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, TW_JL, TW_XN, TW_ZC, WEIRD_QUOTING X-Spam-Check-By: sourceware.org Received: from c2beaomr06.btconnect.com (HELO mail.btconnect.com) (213.123.26.184) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Oct 2011 18:01:24 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2beaomr06.btconnect.com with ESMTP id FDF52088; Fri, 28 Oct 2011 19:01:22 +0100 (BST) Message-Id: <87B813F3-5B28-4F36-A2BD-C0F919D5BE89@sandoe-acoustics.co.uk> From: Iain Sandoe To: GCC Patches Mime-Version: 1.0 (Apple Message framework v936) Subject: [Patch Ada RFA] make sure that multilibs are built with correct s-oscons.ads Date: Fri, 28 Oct 2011 19:01:20 +0100 Cc: Arnaud Charlet , Thomas Quinot X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0302.4EAAEDF1.000F, actions=TAG X-Junkmail-Premium-Raw: score=11/50, refid=2.7.2:2011.10.28.162715:17:11.012, ip=81.138.1.83, rules=__HAS_MSGID, __SANE_MSGID, __MSGID_APPLEMAIL, __TO_MALFORMED_2, __CT, __CTYPE_HAS_BOUNDARY, __CTYPE_MULTIPART, CTYPE_MULTIPART_NO_QUOTE, __CTYPE_MULTIPART_MIXED, __MIME_VERSION, __MIME_VERSION_APPLEMAIL, __MULTIPLE_RCPTS_CC_X2, __HAS_X_MAILER, __X_MAILER_APPLEMAIL, TXT_ATTACHED, __LINES_OF_YELLING, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_ONLY, LINES_OF_YELLING_3, RDNS_GENERIC_POOLED, RDNS_SUSP_GENERIC, __USER_AGENT_APPLEMAIL, RDNS_SUSP, NO_URI_FOUND, MIME_TEXT_ONLY_MP_MIXED, MULTIPLE_RCPTS X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0203.4EAAEDF2.0119, ss=1, fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=multiengine X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. 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