From patchwork Wed Dec 11 14:47:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 300206 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA1432C0090 for ; Thu, 12 Dec 2013 01:48:29 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to; q=dns; s=default; b=GI3v7XGQlykLqhl7R 52um1yIsPpKkxGqrV2JnpqrbSTWguVT7xipqLbxRi+kKJhPzTD5MPpu2ixP28Po9 vrQBGxLXDyP5TZq85AqIgosyU0B3yI/4jj+iTCTqWogvx8uoF140k9Oy5wYrb9cB g7MM4UaV1ytBk1YrJE1Sgv525Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:mime-version:content-type:from:in-reply-to:date:cc :message-id:references:to; s=default; bh=Y+GID5s8YcGJdp3+T7nfnXg ndHk=; b=Bm/3NhMsC8IU8CyLRX/lEUDiulHReoBsssRMav1Rhf4eUgrg859PPEg H6K1/hq6JwzwMvq5W0KDXQMZ7G/w+EQieZ04VIzpfRXS69hj0HY0+9OlyzXV3tQ7 sonCfVQZ176bOXi4bW4k/MY2QHSAhl6Uw4zSv/gP6bDnH+TkuePI= Received: (qmail 18503 invoked by alias); 11 Dec 2013 14:48:23 -0000 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 Received: (qmail 18490 invoked by uid 89); 11 Dec 2013 14:48:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Dec 2013 14:48:21 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Vql52-0000Ju-Dk from Iain_Sandoe@mentor.com ; Wed, 11 Dec 2013 06:48:04 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Dec 2013 06:48:03 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Wed, 11 Dec 2013 14:48:01 +0000 Subject: Re: [Patch Ada/build] deal with some cross/native cross issues MIME-Version: 1.0 (Apple Message framework v1283) From: Iain Sandoe In-Reply-To: <1757219.DocZddhPPW@polaris> Date: Wed, 11 Dec 2013 14:47:58 +0000 CC: "gcc-patches@gcc.gnu.org patches" , Alan Modra , Bernd Edlinger Message-ID: <61449BFE-27DC-4CB4-B6E7-CFB2470127DD@codesourcery.com> References: <66B73BAF-77A5-46B4-9D81-9043E7F17BAA@codesourcery.com> <1757219.DocZddhPPW@polaris> To: Eric Botcazou Hello Eric, I had made the mods to this and done some light testing - then got side-tracked by other priorities. however, since the topic has come up on the list: On 6 Nov 2013, at 12:57, Eric Botcazou wrote: >> I've been trying to improve the building and testing of Darwin for crosses >> and native crosses. >> 1. xgnatugn needs to be run on the build system, so needs to be built with >> the build system's gnatmake. I haven't put a canonical prefix on this since >> this doesn't appear to be done elsewhere. Defined as GNATMAKE_FOR_BUILD and >> passed to sub-processes. > > Why do you need to pass it to ADA_TOOLS_FLAGS_TO_PASS though? Just replace > $(GNATMAKE) with gnatmake. done (FWIW, I think that GNATMAKE_FOR_BUILD would make it obvious for a future reader, but not a big deal) >> 2. Some builds might need to pass LDFLAGS to the gnat* builds. Appended >> LDFLAGS to GCC_LINK. Passed on in gnattools/Make. > > OK. > >> 3. In gnattools, the RTS dir must be for the host and not for the build; >> This actually only showed up when I tried a cross from a 64bit pointer >> machine to a 32bit pointer one (i.e it is easy for it to go unnoticed). > > OK, but don't you need to do the same for gnatmake/gnatbind/gnatlink here? > See gcc-interface/Make-lang.in, line 171 and below, for similar code. it did appear odd that one path had the test and the other did not, however the comment on the native-x case is somewhat misleading since it implies (at least to me) that the *intention* is to use the newly-built target(=host) lib? In the current patch this is changed to place the test and setting RTS_DIR to cover both native and canadian X cases, at least this should be safe. Note that I have *not* tested any canadian-crosses, just cross and native-cross, if you need someone to do a canadian X before this is applied, let me know, and I'll try to set something up. (unless it gets covered by Alan or Bernd's cases). I am re-testing the attached, rebased to tot, but that will take a while, given the machines I have available, OK to apply if [cross & native-cross] testing passes? (if the other folks doing cross-build stuff want to incorporate/take this on, that's OK too). Iain gcc/ada/gcc-interface/Make-lang.in | 9 +++++---- gcc/ada/gcc-interface/Makefile.in | 2 +- gnattools/Makefile.in | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index cd3676f..f7aafc0 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -178,6 +178,10 @@ else GNATLINK_FOR_HOST=$(host)-gnatlink GNATLS_FOR_HOST=$(host)-gnatls + ifneq ($(findstring ada,$(LANGUAGES)),) + RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib ))) + endif + ifeq ($(host), $(target)) # This is a cross native. All the sources are taken from the currently # built runtime. @@ -193,9 +197,6 @@ else else # This is a canadian cross. We should use a toolchain running on the # build platform and targeting the host platform. - ifneq ($(findstring ada,$(LANGUAGES)),) - RTS_DIR:=$(strip $(subst \,/,$(shell $(GNATLS_FOR_HOST) -v | grep adalib ))) - endif ADA_TOOLS_FLAGS_TO_PASS=\ CC="$(CC)" \ CXX="$(CXX)" \ @@ -658,7 +659,7 @@ ada.tags: force ada/doctools/xgnatugn$(build_exeext): ada/xgnatugn.adb -$(MKDIR) ada/doctools $(CP) $^ ada/doctools - cd ada/doctools && $(GNATMAKE) -q xgnatugn + cd ada/doctools && gnatmake -q xgnatugn # Note that doc/gnat_ugn.texi and doc/projects.texi do not depend on # xgnatugn being built so we can distribute a pregenerated doc/gnat_ugn.info diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 885a5ed..6b675f2 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -2415,7 +2415,7 @@ TOOLS_FLAGS_TO_PASS= \ "GNATLINK=$(GNATLINK)" \ "GNATBIND=$(GNATBIND)" -GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) +GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS) # Build directory for the tools. Let's copy the target-dependent # sources using the same mechanism as for gnatlib. The other sources are diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in index fdd6491..118847c 100644 --- a/gnattools/Makefile.in +++ b/gnattools/Makefile.in @@ -24,6 +24,7 @@ srcdir = @srcdir@ libdir = @libdir@ build = @build@ target = @target@ +host = @host@ prefix = @prefix@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -92,6 +93,7 @@ TOOLS_FLAGS_TO_PASS_RE= \ "CC=../../xgcc -B../../" \ "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ "CFLAGS=$(CFLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ "ADAFLAGS=$(ADAFLAGS)" \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ @@ -192,7 +194,11 @@ regnattools: $(GCC_DIR)/stamp-gnatlib-rts # put the host RTS dir first in the PATH to hide the default runtime # files that are among the sources # FIXME: This should be done in configure. +ifeq ($(host), $(build)) RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib ))) +else +RTS_DIR:=$(strip $(subst \,/,$(shell $(host)-gnatls -v | grep adalib ))) +endif gnattools-cross: $(GCC_DIR)/stamp-tools # gnattools1-re $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \