diff options
Diffstat (limited to 'debian/patches/ada-gnattools-cross.diff')
-rw-r--r-- | debian/patches/ada-gnattools-cross.diff | 754 |
1 files changed, 131 insertions, 623 deletions
diff --git a/debian/patches/ada-gnattools-cross.diff b/debian/patches/ada-gnattools-cross.diff index f1f7460..d87f1ea 100644 --- a/debian/patches/ada-gnattools-cross.diff +++ b/debian/patches/ada-gnattools-cross.diff @@ -1,149 +1,34 @@ -# DP: - When building the native gnat, link the gnat tools against -# DP: the build tree (build/$(host_alias)/{libgnatvsn,libgnatprj}.) -# DP: - When building a cross gnat, link against the libgnatvsn-6-dev -# DP: and libgnatprj-6-dev packages. +TODO: Check that the part removing the dependency from stamp-gnatlib1 +to stamp-gnatlib2 is not necessary anymore with gcc-9. + +* Link tools dynamically. +* Prevent direct embedding of libada objects: + Mark ALI files as read-only, remove objects after the build. + A solution keeping the objects would be more intrusive. +* Rebuild gnatbind/make/link with themselves. + This removes unneeded objects inherited from the hardcoded bootstrap list. + The same thing would be useful for gnat1drv, but is less easy. +* TOOLS_ALREADY_COMPILED lists LIBGNAT objects that + gcc/ada/gcc-interface/Makefile should not rebuild. +* Install the shared Ada libraries as '.so.1', not '.so' to conform + to the Debian policy. +* Link libgnat/gnarl with LDFLAGS. +* Create libgnat-BV.so symbolic link, use it and -L to link libgnarl. + This prevents undefined symbols or unwanted usage of host libgnat. +* Compile with -gnatn for efficiency. + Double-check the link since Debian moves some symbols. +* set LD_LIBRARY_PATH so that rebuilt tools can be executed. + +This patch depends on ada-libgnatvsn.diff. + +# DP: - When building a cross gnat, link against the libgnatvsnBV-dev +# DP: package. # DP: This link will be done by /usr/bin/$(host_alias)-gnat*, thus # DP: the native gnat with the same major version will be required. -Index: b/src/gcc/ada/gcc-interface/Makefile.in -=================================================================== ---- a/src/gcc/ada/gcc-interface/Makefile.in -+++ b/src/gcc/ada/gcc-interface/Makefile.in -@@ -102,7 +102,7 @@ INSTALL_DATA_DATE = cp -p - MAKEINFO = makeinfo - TEXI2DVI = texi2dvi - TEXI2PDF = texi2pdf --GNATBIND_FLAGS = -static -x -+GNATBIND_FLAGS = -shared -x - ADA_CFLAGS = - ADAFLAGS = -W -Wall -gnatpg -gnata - FORCE_DEBUG_ADAFLAGS = -g -@@ -141,6 +141,8 @@ target=@target@ - target_cpu=@target_cpu@ - target_vendor=@target_vendor@ - target_os=@target_os@ -+host_alias=@host_alias@ -+host=@host@ - host_cpu=@host_cpu@ - host_vendor=@host_vendor@ - host_os=@host_os@ -@@ -235,7 +237,7 @@ ALL_CPPFLAGS = $(CPPFLAGS) - ALL_COMPILERFLAGS = $(ALL_CFLAGS) - - # This is where we get libiberty.a from. --LIBIBERTY = ../../libiberty/libiberty.a -+LIBIBERTY = ../../libiberty/pic/libiberty.a - - # We need to link against libbacktrace because diagnostic.c in - # libcommon.a uses it. -@@ -247,9 +249,15 @@ LIBS = $(LIBINTL) $(LIBICONV) $(LIBBACKT - LIBDEPS = $(LIBINTL_DEP) $(LIBICONV_DEP) $(LIBBACKTRACE) $(LIBIBERTY) - # Default is no TGT_LIB; one might be passed down or something - TGT_LIB = --TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../libcommon-target.a \ -- ../../libcommon.a ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \ -- ../$(LIBBACKTRACE) ../$(LIBIBERTY) $(SYSLIBS) $(TGT_LIB) -+ -+TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../version.o ../../../libiberty/pic/lrealpath.o \ -+ ../../libbackend.a ../../libcommon-target.a ../../libcommon.a ../../../libcpp/libcpp.a ../$(LIBBACKTRACE) ../$(LIBIBERTY) -lstdc++ -+ -+ifeq ($(host),$(target)) -+ TOOLS_LIBS += -L../$(RTSDIR) -lgnat-6 \ -+ -L../../../$(target_alias)/libgnatvsn -lgnatvsn \ -+ -L../../../$(target_alias)/libgnatprj -lgnatprj -+endif - - # Add -no-pie to TOOLS_LIBS since some of them are compiled with -fno-PIE. - TOOLS_LIBS += @NO_PIE_FLAG@ -@@ -261,7 +269,12 @@ TOOLS_LIBS += @NO_PIE_FLAG@ - INCLUDES = -iquote . -iquote .. -iquote $(srcdir)/ada -iquote $(srcdir) \ - -I $(ftop_srcdir)/include $(GMPINC) - --ADA_INCLUDES = -I- -I. -I$(srcdir)/ada -+ifeq ($(host),$(target)) -+ ADA_INCLUDES = -I../rts \ -+ -I../../../$(target_alias)/libgnatvsn \ -+ -I../../../$(target_alias)/libgnatprj -+endif -+ADA_INCLUDES += -I- -I. -I$(srcdir)/ada - - # Likewise, but valid for subdirectories of the current dir. - # FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in -@@ -309,30 +322,50 @@ Makefile: ../config.status $(srcdir)/ada - # defined in this file into the environment. - .NOEXPORT: - --# Lists of files for various purposes. - --GNATLINK_OBJS = gnatlink.o \ -- a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \ -- gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \ -- osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \ -- sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \ -- types.o validsw.o widechar.o -- --GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \ -- atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o errout.o \ -- erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \ -- gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \ -- make.o makeusg.o makeutl.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o \ -- mlib-tgt-specific.o mlib-utl.o namet.o nlists.o opt.o osint.o osint-m.o \ -- output.o prj.o prj-attr.o prj-attr-pm.o prj-com.o prj-dect.o prj-env.o \ -- prj-conf.o prj-pp.o prj-err.o prj-ext.o prj-nmsc.o prj-pars.o prj-part.o \ -- prj-proc.o prj-strt.o prj-tree.o prj-util.o restrict.o rident.o s-exctab.o \ -- s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \ -- s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \ -- sinput-p.o snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \ -- switch.o switch-m.o table.o targparm.o tempdir.o tree_io.o types.o uintp.o \ -- uname.o urealp.o usage.o widechar.o \ -- $(EXTRA_GNATMAKE_OBJS) -+# Since we don't have gnatmake, we must specify the full list of -+# object files necessary to build gnatmake and gnatlink. -+GNATLINK_OBJS = \ -+gnatlink.o \ -+indepsw.o \ -+validsw.o -+ -+GNATMAKE_OBJS = \ -+aspects.o \ -+errout.o \ -+fname-sf.o \ -+gnatmake.o \ -+make.o \ -+makeusg.o \ -+mlib-prj.o \ -+osint-m.o \ -+restrict.o \ -+sem_aux.o \ -+usage.o \ -+validsw.o \ -+$(EXTRA_GNATMAKE_OBJS) -+ -+EXTRA_TOOLS_OBJS = \ -+bcheck.o \ -+binde.o \ -+bindgen.o \ -+bindusg.o \ -+clean.o \ -+gprep.o \ -+makegpr.o \ -+osint-b.o \ -+osint-l.o \ -+prep.o \ -+prj-makr.o \ -+prj-pp.o \ -+switch-b.o \ -+vms_cmds.o \ -+vms_conv.o \ -+vms_data.o \ -+xr_tabls.o \ -+xref_lib.o -+ -+OBJECTS = $(GNATLINK_OBJS) $(GNATMAKE_OBJS) $(EXTRA_TOOLS_OBJS) - - # Make arch match the current multilib so that the RTS selection code - # picks up the right files. For a given target this must be coherent -@@ -1612,6 +1645,11 @@ ifeq ($(strip $(filter-out s390% linux%, +--- a/src/gcc/ada/Makefile.rtl ++++ b/src/gcc/ada/Makefile.rtl +@@ -1781,6 +1781,11 @@ ifeq ($(strip $(filter-out s390% linux%, LIBRARY_VERSION := $(LIB_VERSION) endif @@ -155,161 +40,30 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in # HP/PA HP-UX 10 ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),) LIBGNAT_TARGET_PAIRS = \ -@@ -2500,153 +2538,6 @@ ADA_EXCLUDE_FILES=$(filter-out \ - $(patsubst %$(objext),%.adb,$(GNATRTL_OBJS)), \ - $(ADA_EXCLUDE_SRCS)) +--- a/src/gcc/ada/gcc-interface/Makefile.in ++++ b/src/gcc/ada/gcc-interface/Makefile.in +@@ -482,6 +482,20 @@ gnatlink-re: ../stamp-tools gnatmake-re + --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS) + $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext) --LIBGNAT=../$(RTSDIR)/libgnat.a -- --TOOLS_FLAGS_TO_PASS= \ -- "CC=$(CC)" \ -- "CFLAGS=$(CFLAGS)" \ -- "LDFLAGS=$(LDFLAGS)" \ -- "ADAFLAGS=$(ADAFLAGS)" \ -- "INCLUDES=$(INCLUDES_FOR_SUBDIR)"\ -- "ADA_INCLUDES=$(ADA_INCLUDES) $(ADA_INCLUDES_FOR_SUBDIR)"\ -- "libsubdir=$(libsubdir)" \ -- "exeext=$(exeext)" \ -- "fsrcdir=$(fsrcdir)" \ -- "srcdir=$(fsrcdir)" \ -- "TOOLS_LIBS=$(TOOLS_LIBS) $(TGT_LIB)" \ -- "GNATMAKE=$(GNATMAKE)" \ -- "GNATLINK=$(GNATLINK)" \ -- "GNATBIND=$(GNATBIND)" -- --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 --# accessed using the vpath directive below -- --../stamp-tools: -- -$(RM) tools/* -- -$(RMDIR) tools -- -$(MKDIR) tools -- -(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .) -- -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ -- $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\ -- $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \ -- tools/$(word 1,$(subst <, ,$(PAIR)));) -- touch ../stamp-tools -- --# when compiling the tools, the runtime has to be first on the path so that --# it hides the runtime files lying with the rest of the sources --ifeq ($(TOOLSCASE),native) -- vpath %.ads ../$(RTSDIR) ../ -- vpath %.adb ../$(RTSDIR) ../ -- vpath %.c ../$(RTSDIR) ../ -- vpath %.h ../$(RTSDIR) ../ --endif -- --# in the cross tools case, everything is compiled with the native --# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES --ifeq ($(TOOLSCASE),cross) -- vpath %.ads ../ -- vpath %.adb ../ -- vpath %.c ../ -- vpath %.h ../ --endif -- --# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap --# reasons: gnatmake should be built with a recent compiler, a recent compiler --# may not generate ALI files compatible with an old gnatmake so it is important --# to be able to build gnatmake without a version of gnatmake around. Once --# everything has been compiled once, gnatmake can be recompiled with itself --# (see target gnattools1-re) --gnattools1: ../stamp-tools ../stamp-gnatlib-$(RTSDIR) -- $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ -- TOOLSCASE=native \ -- ../../gnatmake$(exeext) ../../gnatlink$(exeext) -- --# gnatmake/link can be built with recent gnatmake/link if they are available. --# This is especially convenient for building cross tools or for rebuilding --# the tools when the original bootstrap has already be done. --gnattools1-re: ../stamp-tools -- $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ -- TOOLSCASE=cross INCLUDES="" gnatmake-re gnatlink-re -- --# these tools are built with gnatmake & are common to native and cross --gnattools2: ../stamp-tools -- $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ -- TOOLSCASE=native common-tools $(EXTRA_GNATTOOLS) -- --# those tools are only built for the cross version --gnattools4: ../stamp-tools --ifeq ($(ENABLE_VXADDR2LINE),true) -- $(MAKE) -C tools -f ../Makefile $(TOOLS_FLAGS_TO_PASS) \ -- TOOLSCASE=cross top_buildir=../../.. \ -- ../../vxaddr2line$(exeext) --endif -- --common-tools: ../stamp-tools -- $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ -- --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \ -- 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) $(LDFLAGS) -- $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) $(LDFLAGS) -- --../../gnatdll$(exeext): ../stamp-tools -- $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)" -- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll -- $(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -- --../../vxaddr2line$(exeext): ../stamp-tools -- $(GNATMAKE) -c $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)" -- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line -- $(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" ../targext.o $(CLIB) -- --gnatmake-re: ../stamp-tools -- $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)" -- $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)" -- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake -- $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -- --# Note the use of the "mv" command in order to allow gnatlink to be linked with --# with the former version of gnatlink itself which cannot override itself. --# gnatlink-re cannot be run at the same time as gnatmake-re, hence the --# dependency --gnatlink-re: ../stamp-tools gnatmake-re -- $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)" -- $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink -- $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ -- --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -- $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext) -- --# Needs to be built with CC=gcc --# Since the RTL should be built with the latest compiler, remove the --# stamp target in the parent directory whenever gnat1 is rebuilt -- --# Likewise for the tools --../../gnatmake$(exeext): $(P) b_gnatm.o $(GNATMAKE_OBJS) -- +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) -- --../../gnatlink$(exeext): $(P) b_gnatl.o $(GNATLINK_OBJS) -- +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) $(TOOLS1_LIBS) -- - ../stamp-gnatlib-$(RTSDIR): - @if [ ! -f stamp-gnatlib-$(RTSDIR) ] ; \ - then \ -@@ -2685,14 +2576,10 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD ++gnatbind-re: ../stamp-tools gnatmake-re gnatlink-re ++ $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatbind --GCC="$(CC) $(ALL_ADAFLAGS)" ++ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatbind ++ $(GNATLINK) -v gnatbind -o ../../gnatbind$(exeext) \ ++ --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS) ++ ++# When driven by gnattools/Makefile for a native build, ++# TOOLS_ALREADY_COMPILED will list objects in the target standard Ada ++# libraries, that Make should avoid rebuilding. ++# We cannot use recursive variables to avoid an infinite loop, ++# so we must put this after definition of EXTRA_GNATMAKE_OBJS. ++GNATLINK_OBJS := $(filter-out $(TOOLS_ALREADY_COMPILED),$(GNATLINK_OBJS)) ++GNATMAKE_OBJS := $(filter-out $(TOOLS_ALREADY_COMPILED),$(GNATMAKE_OBJS)) ++ + # Needs to be built with CC=gcc + # Since the RTL should be built with the latest compiler, remove the + # stamp target in the parent directory whenever gnat1 is rebuilt +@@ -530,14 +544,10 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD # Also install the .dSYM directories if they exist (these directories # contain the debug information for the shared libraries on darwin) for file in gnat gnarl; do \ @@ -326,28 +80,7 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \ $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \ $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ -@@ -2705,19 +2592,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD - cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb - cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads - --../stamp-gnatlib2-$(RTSDIR): -- $(RM) $(RTSDIR)/s-*.ali -- $(RM) $(RTSDIR)/s-*$(objext) -- $(RM) $(RTSDIR)/a-*.ali -- $(RM) $(RTSDIR)/a-*$(objext) -- $(RM) $(RTSDIR)/*.ali -- $(RM) $(RTSDIR)/*$(objext) -- $(RM) $(RTSDIR)/*$(arext) -- $(RM) $(RTSDIR)/*$(soext) -- touch ../stamp-gnatlib2-$(RTSDIR) -- $(RM) ../stamp-gnatlib-$(RTSDIR) -- --../stamp-gnatlib1-$(RTSDIR): Makefile ../stamp-gnatlib2-$(RTSDIR) -+../stamp-gnatlib1-$(RTSDIR): Makefile - $(RMDIR) $(RTSDIR) - $(MKDIR) $(RTSDIR) - $(CHMOD) u+w $(RTSDIR) -@@ -2782,7 +2657,7 @@ $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib +@@ -607,7 +617,7 @@ $(RTSDIR)/s-oscons.ads: ../stamp-gnatlib $(OSCONS_EXTRACT) ; \ ../bldtools/oscons/xoscons s-oscons) @@ -356,7 +89,13 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in test -f $(RTSDIR)/s-oscons.ads || exit 1 # C files $(MAKE) -C $(RTSDIR) \ -@@ -2820,32 +2695,44 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../ +@@ -641,36 +651,51 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../ + $(RANLIB_FOR_TARGET) $(RTSDIR)/libgmem$(arext) + endif + $(CHMOD) a-wx $(RTSDIR)/*.ali ++# Provide .ads .adb (read-only).ali .so .a, but prevent direct use of .o. ++ $(RM) $(RTSDIR)/*.o + touch ../stamp-gnatlib-$(RTSDIR) # Warning: this target assumes that LIBRARY_VERSION has been set correctly. gnatlib-shared-default: @@ -391,55 +130,68 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \ $(PICFLAG_FOR_TARGET) \ - -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ -+ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ ++ -o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 $(LDFLAGS) \ $(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \ - $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ + $(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ - $(MISCLIB) -lm $(GNATLIBLDFLAGS) + $(MISCLIB) -lm ++ cd $(RTSDIR) && $(LN_S) -f libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ ++ libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) cd $(RTSDIR); `echo "$(GCC_FOR_TARGET)" \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` -shared $(GNATLIBCFLAGS) \ $(PICFLAG_FOR_TARGET) \ - -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ -+ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ ++ -o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 $(LDFLAGS) \ $(GNATRTL_TASKING_OBJS) \ - $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ + $(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ - $(THREADSLIB) $(GNATLIBLDFLAGS) ++ -L. -lgnat$(hyphen)$(LIBRARY_VERSION) \ + $(THREADSLIB) - cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ - libgnat$(soext) - cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \ - libgnarl$(soext) -+ cd $(RTSDIR); for lib in gnat gnarl; do \ -+ l=lib$${lib}$(hyphen)$(LIBRARY_VERSION)$(soext); \ -+ $(LN_S) $$l.1 $$l; \ -+ done ++ cd $(RTSDIR) && $(LN_S) -f libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \ ++ libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) + $(CHMOD) a-wx $(RTSDIR)/*.ali + # Create static libgnat and libgnarl compiled with -fPIC + $(RM) $(RTSDIR)/libgnat_pic$(arext) $(RTSDIR)/libgnarl_pic$(arext) +@@ -681,6 +706,8 @@ gnatlib-shared-default: + $(addprefix $(RTSDIR)/,$(GNATRTL_TASKING_OBJS)) + $(RANLIB_FOR_TARGET) $(RTSDIR)/libgnarl_pic$(arext) + ++# Provide .ads .adb (read-only).ali .so .a, but prevent direct use of .o. ++ $(RM) $(RTSDIR)/*.o + gnatlib-shared-dual: $(MAKE) $(FLAGS_TO_PASS) \ -@@ -2855,9 +2742,8 @@ gnatlib-shared-dual: - GNATLIBLDFLAGS="$(GNATLIBLDFLAGS)" \ +@@ -690,21 +717,15 @@ gnatlib-shared-dual: + PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ - gnatlib-shared-default - $(MV) $(RTSDIR)/libgna*$(soext) . +- $(MV) $(RTSDIR)/libgnat_pic$(arext) . +- $(MV) $(RTSDIR)/libgnarl_pic$(arext) . - $(RM) ../stamp-gnatlib2-$(RTSDIR) + gnatlib + $(RM) $(RTSDIR)/*.o $(RTSDIR)/*.ali $(MAKE) $(FLAGS_TO_PASS) \ GNATLIBFLAGS="$(GNATLIBFLAGS)" \ GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \ -@@ -2865,8 +2751,7 @@ gnatlib-shared-dual: - GNATLIBLDFLAGS="$(GNATLIBLDFLAGS)" \ + GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ - gnatlib - $(MV) libgna*$(soext) $(RTSDIR) +- $(MV) libgnat_pic$(arext) $(RTSDIR) +- $(MV) libgnarl_pic$(arext) $(RTSDIR) + gnatlib-shared-default gnatlib-shared-dual-win32: $(MAKE) $(FLAGS_TO_PASS) \ -@@ -2876,17 +2761,15 @@ gnatlib-shared-dual-win32: +@@ -714,17 +735,15 @@ gnatlib-shared-dual-win32: PICFLAG_FOR_TARGET="$(PICFLAG_FOR_TARGET)" \ MULTISUBDIR="$(MULTISUBDIR)" \ THREAD_KIND="$(THREAD_KIND)" \ @@ -460,302 +212,58 @@ Index: b/src/gcc/ada/gcc-interface/Makefile.in # ??? we need to add the option to support auto-import of arrays/records to # the GNATLIBFLAGS when this will be supported by GNAT. At this point we will -@@ -3136,6 +3019,68 @@ targext.o : targext.c - $(ALL_CPPFLAGS) $(INCLUDES_FOR_SUBDIR) \ - $< $(OUTPUT_OPTION) - -+GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS) -+ -+../stamp-tools: -+ -$(RM) tools/* -+ -$(RMDIR) tools -+ -$(MKDIR) tools -+ -(cd tools; $(LN_S) ../sdefault.adb ../snames.ads ../snames.adb .) -+ -$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ -+ $(RM) tools/$(word 1,$(subst <, ,$(PAIR)));\ -+ $(LN_S) $(fsrcpfx)ada/$(word 2,$(subst <, ,$(PAIR))) \ -+ tools/$(word 1,$(subst <, ,$(PAIR)));) -+ touch ../stamp-tools -+ -+gnatmake-re: ../stamp-tools -+ $(GNATMAKE) -j0 $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)" -+ $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)" -+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake -+ $(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ -+# Note the use of the "mv" command in order to allow gnatlink to be linked with -+# with the former version of gnatlink itself which cannot override itself. -+# gnatlink-re cannot be run at the same time as gnatmake-re, hence the -+# dependency -+gnatlink-re: ../stamp-tools gnatmake-re -+ $(GNATMAKE) -j0 -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)" -+ $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink -+ $(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(MV) ../../gnatlinknew$(exeext) ../../gnatlink$(exeext) -+ -+# Likewise for the tools -+../../gnatmake$(exeext): $(P) b_gnatm.o $(GNATMAKE_OBJS) -+ +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) $(TOOLS_LIBS) -+ -+../../gnatlink$(exeext): $(P) b_gnatl.o $(GNATLINK_OBJS) -+ +$(GCC_LINK) $(ALL_CFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) $(TOOLS_LIBS) -+ -+common-tools: ../stamp-tools -+ $(GNATMAKE) -j0 -c -b $(ADA_INCLUDES) \ -+ --GNATBIND="$(GNATBIND)" --GCC="$(CC) $(ALL_ADAFLAGS)" \ -+ gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \ -+ gnatclean -bargs $(ADA_INCLUDES) $(GNATBIND_FLAGS) -+ $(GNATLINK) -v gnatcmd -o ../../gnat$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ -+ $(TOOLS_LIBS) $(LDFLAGS) -+ - # In GNU Make, ignore whether `stage*' exists. - .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap - .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4 -Index: b/src/gnattools/Makefile.in -=================================================================== --- a/src/gnattools/Makefile.in +++ b/src/gnattools/Makefile.in -@@ -52,7 +52,7 @@ WARN_CFLAGS = @warn_cflags@ - ADA_CFLAGS=@ADA_CFLAGS@ - - # Variables for gnattools. --ADAFLAGS= -gnatpg -gnata -+ADAFLAGS= -gnatn +@@ -75,16 +75,24 @@ CXX_LFLAGS = \ + -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ + -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs - # For finding the GCC build dir, which is used far too much - GCC_DIR=../gcc -@@ -70,28 +70,168 @@ INCLUDES_FOR_SUBDIR = -iquote . -iquote - ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)/ada - - CXX_LFLAGS = \ -- -B../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ -- -B../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ -- -L../../../$(target_noncanonical)/libstdc++-v3/src/.libs \ -- -L../../../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs -+ -B../$(target_noncanonical)/libstdc++-v3/src/.libs \ -+ -B../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ -+ -L../$(target_noncanonical)/libstdc++-v3/src/.libs \ -+ -L../$(target_noncanonical)/libstdc++-v3/libsupc++/.libs \ -+ -L../$(target_noncanonical)/libatomic/.libs -+ -+CFLAGS=-O2 -Wall -+ADA_CFLAGS=-O2 -gnatn -+ADA_INCLUDES=-nostdinc -I- -I. -I../gcc/ada/rts \ -+ -I../$(target_noncanonical)/libgnatvsn -I../$(target_noncanonical)/libgnatprj -+LIB_VERSION=$(strip $(shell grep ' Library_Version :' \ -+ ../$(target_noncanonical)/libgnatvsn/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/')) -+SHARED_ADA_LIBS := -L../gcc/ada/rts -lgnat-$(LIB_VERSION) -+SHARED_ADA_LIBS += -L../$(target_noncanonical)/libgnatvsn -lgnatvsn -+SHARED_ADA_LIBS += -L../$(target_noncanonical)/libgnatprj -lgnatprj -+STATIC_ADA_LIBS := ../gcc/ada/rts/libgnat.a -+STATIC_GCC_LIBS := ../gcc/libcommon-target.a ../gcc/libcommon.a ../libcpp/libcpp.a \ -+../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a -+ -+# We will use the just-built compiler to compile and link everything. -+GCC=../gcc/xgcc -B../gcc/ -no-pie -+GXX=../gcc/xg++ -B../gcc/ -no-pie -+ -+# File lists -+# ---------- -+ -+# File associations set by configure -+EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@ -+TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@ -+ -+# Stage 1 builds xgcc and gnatbind; we can use them to build -+# gnatmake-static and gnatlink-static, then use gnatmake-static and -+# gnatlink-static to build the other tools. The reason we first build -+# statically-linked versions of gnatmake and gnatlink is so we can run -+# them with confidence on all build platforms, without LD_LIBRARY_PATH -+# or some such variable. -+ -+# The tools we will build using gnatmake-static and gnatlink-static. -+TOOLS := gnat gnatbind gnatchop gnatclean gnatfind gnatkr gnatls gnatlink -+TOOLS += gnatmake gnatname gnatprep gnatxref -+ -+# Since we don't have gnatmake, we must specify the full list of -+# object files necessary to build gnatmake and gnatlink. -+GNATLINK_OBJS = \ -+gnatlink.o \ -+indepsw.o \ -+validsw.o \ -+link.o -+ -+GNATMAKE_OBJS = \ -+aspects.o \ -+errout.o \ -+fname-sf.o \ -+gnatmake.o \ -+make.o \ -+makeusg.o \ -+mlib-prj.o \ -+osint-m.o \ -+restrict.o \ -+sem_aux.o \ -+usage.o \ -+validsw.o \ -+link.o \ -+$(EXTRA_GNATMAKE_OBJS) -+ -+EXTRA_TOOLS_OBJS = \ -+bcheck.o \ -+binde.o \ -+bindgen.o \ -+bindusg.o \ -+clean.o \ -+gprep.o \ -+makegpr.o \ -+osint-b.o \ -+osint-l.o \ -+prep.o \ -+prj-makr.o \ -+prj-pp.o \ -+switch-b.o \ -+vms_cmds.o \ -+vms_conv.o \ -+vms_data.o \ -+xr_tabls.o \ -+xref_lib.o -+ -+OBJECTS = $(GNATLINK_OBJS) $(GNATMAKE_OBJS) $(EXTRA_TOOLS_OBJS) -+ -+# Makefile targets -+# ---------------- -+ -+.PHONY: gnattools gnattools-native gnattools-cross regnattools -+gnattools: @default_gnattools_target@ -+ -+BODIES := $(foreach f,$(OBJECTS),$(wildcard $(patsubst %.o,@srcdir@/../gcc/ada/%.adb,$(f)))) -+SPECS := $(foreach f,$(OBJECTS),$(wildcard $(patsubst %.o,@srcdir@/../gcc/ada/%.ads,$(f)))) -+ -+$(notdir $(SPECS) $(BODIES)): stamp-gnattools-sources -+ -+stamp-gnattools-sources: -+ for file in $(BODIES) $(SPECS); do \ -+ $(LN_S) -f $$file .; \ -+ done -+ rm -f sdefault.adb; $(LN_S) ../gcc/ada/sdefault.adb . -+ $(foreach PAIR,$(TOOLS_TARGET_PAIRS), \ -+ rm -f $(word 1,$(subst <, ,$(PAIR)));\ -+ $(LN_S) @srcdir@/../gcc/ada/$(word 2,$(subst <, ,$(PAIR))) \ -+ $(word 1,$(subst <, ,$(PAIR)));) -+ touch $@ -+ -+gnattools-native: ../gcc/ada/rts/libgnat-$(LIB_VERSION).so -+gnattools-native: ../$(target_noncanonical)/libgnatvsn/libgnatvsn.so -+gnattools-native: stamp-gnattools-sources -+gnattools-native: $(TOOLS) -+ cp -lpf $(TOOLS) ../gcc -+ -+$(TOOLS) gnatcmd: | gnatmake-static gnatlink-static -+ -+vpath %.c @srcdir@/../gcc/ada:@srcdir@/../gcc -+vpath %.h @srcdir@/../gcc/ada -+ -+# gnatlink -+ -+gnatlink-static: $(GNATLINK_OBJS) b_gnatl.o -+ $(GXX) -o $@ $^ \ -+ ../$(target_noncanonical)/libgnatprj/libgnatprj.a \ -+ ../$(target_noncanonical)/libgnatvsn/libgnatvsn.a \ -+ ../gcc/ada/rts/libgnat.a $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) -+ -+gnatlink: $(GNATLINK_OBJS) b_gnatl.o -+ $(GXX) -o $@ $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) -+ -+b_gnatl.adb: $(GNATLINK_OBJS) -+ ../gcc/gnatbind -o $@ $(ADA_INCLUDES) gnatlink.ali -+ -+# gnatmake -+ -+gnatmake-static: $(GNATMAKE_OBJS) b_gnatm.o -+ $(GXX) -o $@ $(ADA_CFLAGS) $^ \ -+ ../$(target_noncanonical)/libgnatprj/libgnatprj.a \ -+ ../$(target_noncanonical)/libgnatvsn/libgnatvsn.a \ -+ $(STATIC_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) -+ -+gnatmake: $(GNATMAKE_OBJS) b_gnatm.o -+ $(GXX) -o $@ $(ADA_CFLAGS) $^ $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) -+ -+b_gnatm.adb: $(GNATMAKE_OBJS) -+ ../gcc/gnatbind -o $@ $(ADA_INCLUDES) gnatmake.ali -+ -+# Other tools -+gnat: gnatcmd -+ cp -lp $< $@ -+ -+gnatbind gnatchop gnatclean gnatcmd gnatfind gnatkr gnatls gnatname gnatprep \ -+gnatxref: link.o -+ if [ ! -f $@.adb ] ; then $(LN_S) ../../src/gcc/ada/$@.ad[bs] .; fi -+ ./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \ -+ --GCC="$(GCC)" \ -+ --GNATBIND=../gcc/gnatbind -+ ./gnatlink-static -o $@ $@.ali $^ \ -+ $(ADA_INCLUDES) $(SHARED_ADA_LIBS) $(STATIC_GCC_LIBS) $(CXX_LFLAGS) $(LDFLAGS) \ -+ --GCC="$(GXX) $(ADA_INCLUDES)" - --# Variables for gnattools, native --TOOLS_FLAGS_TO_PASS_NATIVE= \ -- "CC=../../xgcc -B../../" \ -- "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ -- "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ ++rtsdir := $(abspath ../gcc/ada/rts) ++vsndir := $(abspath ../$(target_noncanonical)/libgnatvsn/lib-for-gnat-tools) ++ + # Variables for gnattools, native + TOOLS_FLAGS_TO_PASS_NATIVE= \ + "CC=../../xgcc -B../../" \ + "CXX=../../xg++ -B../../ $(CXX_LFLAGS)" \ + "CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \ - "LDFLAGS=$(LDFLAGS)" \ - "ADAFLAGS=$(ADAFLAGS)" \ -- "ADA_CFLAGS=$(ADA_CFLAGS)" \ -- "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ ++ "LDFLAGS=$(LDFLAGS) -Wl,--no-allow-shlib-undefined \ ++ -Wl,--no-copy-dt-needed-entries -Wl,--no-undefined" \ ++ "ADAFLAGS=$(ADAFLAGS) -gnatn" \ + "ADA_CFLAGS=$(ADA_CFLAGS)" \ + "INCLUDES=$(INCLUDES_FOR_SUBDIR)" \ - "ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\ -- "exeext=$(exeext)" \ -- "fsrcdir=$(fsrcdir)" \ -- "srcdir=$(fsrcdir)" \ -- "GNATMAKE=../../gnatmake" \ -- "GNATLINK=../../gnatlink" \ -- "GNATBIND=../../gnatbind" \ -- "TOOLSCASE=native" - - # Variables for regnattools - TOOLS_FLAGS_TO_PASS_RE= \ -@@ -184,20 +324,12 @@ $(GCC_DIR)/stamp-tools: - $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));) - touch $(GCC_DIR)/stamp-tools - --# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap --# reasons: gnatmake should be built with a recent compiler, a recent compiler --# may not generate ALI files compatible with an old gnatmake so it is important --# to be able to build gnatmake without a version of gnatmake around. Once --# everything has been compiled once, gnatmake can be recompiled with itself --# (see target regnattools) --gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts -- # gnattools1 -- $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ -- $(TOOLS_FLAGS_TO_PASS_NATIVE) \ -- ../../gnatmake$(exeext) ../../gnatlink$(exeext) -- # gnattools2 -- $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ -- $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools -+%.o: %.adb -+ $(GCC) -c -o $@ $< $(ADA_CFLAGS) $(ADA_INCLUDES) -+ -+%.o: %.ads -+ $(GCC) -c -o $@ $< $(ADA_CFLAGS) $(ADA_INCLUDES) -+ ++ "ADA_INCLUDES=-I- -nostdinc -I$(vsndir) -I$(rtsdir) $(ADA_INCLUDES_FOR_SUBDIR)" \ ++ "TOOLS_ALREADY_COMPILED=$(foreach d, $(vsndir) $(rtsdir), \ ++ $(patsubst $(d)/%.ali,%.o, $(wildcard $(d)/*.ali)))" \ ++ 'LIBGNAT=-L$(vsndir) -lgnatvsn -L$(rtsdir) -lgnat-$$(LIB_VERSION)' \ ++ "GNATBIND_FLAGS=-nostdlib -x" \ + "exeext=$(exeext)" \ + "fsrcdir=$(fsrcdir)" \ + "srcdir=$(fsrcdir)" \ +@@ -190,6 +197,10 @@ $(GCC_DIR)/stamp-tools: + # to be able to build gnatmake without a version of gnatmake around. Once + # everything has been compiled once, gnatmake can be recompiled with itself + # (see target regnattools) ++gnattools-native: export LD_LIBRARY_PATH := \ ++ $(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(vsndir):$(rtsdir) ++# Useful even for 1st pass, as ../../gnatmake may already be ++# dynamically linked in case this target has already been invoked. + gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib-rts + # gnattools1 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ +@@ -198,6 +209,13 @@ gnattools-native: $(GCC_DIR)/stamp-tools + # gnattools2 + $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ + $(TOOLS_FLAGS_TO_PASS_NATIVE) common-tools ++# The hard-coded object lists for gnatbind/make/link contain unneeded ++# objects. Use the fresh tools to recompute dependencies. ++# A separate Make run avoids race conditions between gnatmakes ++# building the same object for common-tools and gnat*-re. ++# (parallelism is already forbidden between gnat*-re targets) ++ $(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \ ++ $(TOOLS_FLAGS_TO_PASS_NATIVE) gnatbind-re gnatmake-re gnatlink-re # gnatmake/link can be built with recent gnatmake/link if they are available. # This is especially convenient for building cross tools or for rebuilding |