* [Patch Ada/build] deal with some cross/native cross issues @ 2013-11-03 21:35 Iain Sandoe 2013-11-06 13:13 ` Eric Botcazou 0 siblings, 1 reply; 3+ messages in thread From: Iain Sandoe @ 2013-11-03 21:35 UTC (permalink / raw) To: gcc patches; +Cc: Eric Botcazou, Arnaud Charlet [-- Attachment #1: Type: text/plain, Size: 1722 bytes --] Hi, I've been trying to improve the building and testing of Darwin for crosses and native crosses. This has thrown up a few small glitches in the Ada build stuff (that would seem to apply to any build-host-nativeX scenario, not just darwin). I would imagine it would be beneficial to resolve these, since Ada requires Ada - a native cross seems like the only realistic way onto a new target. Having said that, I am not fully conversant with the build permutations you need to achieve - so the fixes proposed here might not be the best solutions; comments and suggestions welcome. === 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. 2. Some builds might need to pass LDFLAGS to the gnat* builds. Appended LDFLAGS to GCC_LINK. Passed on in gnattools/Make. 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). With these changes I can build working crosses and native crosses at least on Darwin between machines of different pointer size and endianess. OK for trunk? Iain gcc/ada: * gcc-interface/Make-lang.in (GNATMAKE_FOR_BUILD): New, pass to subordinate builds. (xgnatugn): Build with GNATMAKE_FOR_BUILD. * gcc-interface/Makefile.in (GCC_LINK): Append LDFLAGS. gnattools: * Makefile.in (TOOLS_FLAGS_TO_PASS_RE): Pass LDFLAGS. (RTS_DIR): Use $(host)-gnatls when the host differs from build. [-- Attachment #2: ada-x-build-diff.txt --] [-- Type: text/plain, Size: 4063 bytes --] gcc/ada/gcc-interface/Make-lang.in | 10 ++++++++-- gcc/ada/gcc-interface/Makefile.in | 2 +- gnattools/Makefile.in | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index cd3676f..dd5392f 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -53,6 +53,8 @@ CHECKING_ADAFLAGS= -gnata endif WARN_ADAFLAGS= -W -Wall +GNATMAKE_FOR_BUILD=gnatmake + # For native builds, the base compiler might be old and we need to arrange for # style warnings not to be flagged as errors during stage1. Cross compilers # need to be built by a recent/matching native so we might as well leave the @@ -147,7 +149,8 @@ ifeq ($(build), $(host)) ADA_INCLUDES="-I- -I../rts" \ GNATMAKE="../../gnatmake" \ GNATLINK="../../gnatlink" \ - GNATBIND="../../gnatbind" + GNATBIND="../../gnatbind" \ + GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" else # This is a regular cross compiler. Use the native compiler to compile # the tools. @@ -166,6 +169,7 @@ ifeq ($(build), $(host)) GNATMAKE="gnatmake" \ GNATBIND="gnatbind" \ GNATLINK="gnatlink" \ + GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \ LIBGNAT="" endif else @@ -189,6 +193,7 @@ else GNATMAKE="$(GNATMAKE_FOR_HOST)" \ GNATBIND="$(GNATBIND_FOR_HOST)" \ GNATLINK="$(GNATLINK_FOR_HOST)" \ + GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \ LIBGNAT="" else # This is a canadian cross. We should use a toolchain running on the @@ -204,6 +209,7 @@ else GNATMAKE="$(GNATMAKE_FOR_HOST)" \ GNATBIND="$(GNATBIND_FOR_HOST)" \ GNATLINK="$(GNATLINK_FOR_HOST)" \ + GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)" \ LIBGNAT="" endif endif @@ -658,7 +664,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_FOR_BUILD) -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 91778c5..d1a4981 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 \ [-- Attachment #3: Type: text/plain, Size: 2 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch Ada/build] deal with some cross/native cross issues 2013-11-03 21:35 [Patch Ada/build] deal with some cross/native cross issues Iain Sandoe @ 2013-11-06 13:13 ` Eric Botcazou 2013-12-11 14:48 ` Iain Sandoe 0 siblings, 1 reply; 3+ messages in thread From: Eric Botcazou @ 2013-11-06 13:13 UTC (permalink / raw) To: Iain Sandoe; +Cc: gcc-patches, Arnaud Charlet > I've been trying to improve the building and testing of Darwin for crosses > and native crosses. > > This has thrown up a few small glitches in the Ada build stuff (that would > seem to apply to any build-host-nativeX scenario, not just darwin). I > would imagine it would be beneficial to resolve these, since Ada requires > Ada - a native cross seems like the only realistic way onto a new target. Thanks for working on this. > 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. > 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. -- Eric Botcazou ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch Ada/build] deal with some cross/native cross issues 2013-11-06 13:13 ` Eric Botcazou @ 2013-12-11 14:48 ` Iain Sandoe 0 siblings, 0 replies; 3+ messages in thread From: Iain Sandoe @ 2013-12-11 14:48 UTC (permalink / raw) To: Eric Botcazou; +Cc: gcc-patches@gcc.gnu.org patches, Alan Modra, Bernd Edlinger [-- Attachment #1: Type: text/plain, Size: 2255 bytes --] 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 [-- Attachment #2: ada-x-build-v2-diff.txt --] [-- Type: text/plain, Size: 3226 bytes --] 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 \ [-- Attachment #3: Type: text/plain, Size: 2 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-11 14:48 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-11-03 21:35 [Patch Ada/build] deal with some cross/native cross issues Iain Sandoe 2013-11-06 13:13 ` Eric Botcazou 2013-12-11 14:48 ` Iain Sandoe
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).