re PR ada/83016 (gnat1: warning: command line option ‘-nostdinc++’ is valid for C...
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 19 Nov 2017 22:36:25 +0000 (22:36 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 19 Nov 2017 22:36:25 +0000 (22:36 +0000)
PR ada/83016
* gnatlink.adb (Process_Args): Accept multiple switches for --LINK.
(Usage): Adjust.
* gcc-interface/Makefile.in (GCC_LINK): Remove $(ADA_INCLUDES).
(common-tools): Pass $(CC) as --GCC= and $(GCC_LINK) as --LINK= in
the invocations of $(GNATLINK).
(../../gnatdll$(exeext)): Likewise.
(../../vxaddr2line$(exeext)): Likewise.
(gnatmake-re): Likewise.
(gnatlink-re): Likewise.

From-SVN: r254940

gcc/ada/ChangeLog
gcc/ada/gcc-interface/Makefile.in
gcc/ada/gnatlink.adb

index 28cfd17112b2de9ec369fb4b5827ae042d1d41d6..1d829f2040af468f8ec74b7543a1460ba143353f 100644 (file)
@@ -1,3 +1,16 @@
+2017-11-20  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR ada/83016
+       * gnatlink.adb (Process_Args): Accept multiple switches for --LINK.
+       (Usage): Adjust.
+       * gcc-interface/Makefile.in (GCC_LINK): Remove $(ADA_INCLUDES).
+       (common-tools): Pass $(CC) as --GCC= and $(GCC_LINK) as --LINK= in
+       the invocations of $(GNATLINK).
+       (../../gnatdll$(exeext)): Likewise.
+       (../../vxaddr2line$(exeext)): Likewise.
+       (gnatmake-re): Likewise.
+       (gnatlink-re): Likewise.
+
 2017-11-16  Doug Rupp  <rupp@adacore.com>
 
        * gcc-interface/Makefile.in: Merge Aarch64 and ARM "ifeq" blocks.
@@ -32,7 +45,7 @@
 
        * doc/gnat_ugn/gnat_utility_programs.rst (GNAT UGN): Add
        gnatsymbolize documentation.
-       * gnat_ugn.texi: Regenerate.
+       * gnat_ugn.texi: Regenerate.
 
 2017-11-16  Steve Baird  <baird@adacore.com>
 
index db67dcbf1879a92929a8500cd7479192b7e840f9..a6da00ec92c312a80236104b80579a760386ce18 100644 (file)
@@ -2111,7 +2111,7 @@ TOOLS_FLAGS_TO_PASS=              \
        "GNATLINK=$(GNATLINK)"  \
        "GNATBIND=$(GNATBIND)"
 
-GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(ADA_INCLUDES) $(LDFLAGS)
+GCC_LINK=$(CXX) $(GCC_LINK_FLAGS) $(LDFLAGS)
 
 # Build directory for the tools. Let's copy the target-dependent
 # sources using the same mechanism as for gnatlib. The other sources are
@@ -2183,40 +2183,42 @@ common-tools: ../stamp-tools
          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)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatchop -o ../../gnatchop$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatkr -o ../../gnatkr$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatls -o ../../gnatls$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatprep -o ../../gnatprep$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatxref -o ../../gnatxref$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatfind -o ../../gnatfind$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatname -o ../../gnatname$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \
-               --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
 
 ../../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)
+       $(GNATLINK) -v gnatdll -o $@ \
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(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)
+       $(GNATLINK) -v vxaddr2line -o $@ \
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(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)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(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.
@@ -2226,7 +2228,7 @@ 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)
+         --GCC="$(CC) $(ADA_INCLUDES)" --LINK="$(GCC_LINK)" $(TOOLS_LIBS)
        $(MV)  ../../gnatlinknew$(exeext)  ../../gnatlink$(exeext)
 
 # Needs to be built with CC=gcc
index 5e290eb639f77274871b3c22cb818af914ace4ac..4b7f21d97e1bb0e4d579116cb32150aec49ada89 100644 (file)
@@ -529,15 +529,35 @@ procedure Gnatlink is
                      Exit_With_Error ("Missing argument for --LINK=");
                   end if;
 
-                  Linker_Path :=
-                    System.OS_Lib.Locate_Exec_On_Path (Arg (8 .. Arg'Last));
+                  declare
+                     L_Args : constant Argument_List_Access :=
+                               Argument_String_To_List (Arg (8 .. Arg'Last));
+                  begin
+                     --  The linker program is the first argument
+
+                     Linker_Path :=
+                      System.OS_Lib.Locate_Exec_On_Path (L_Args.all (1).all);
+
+                     if Linker_Path = null then
+                        Exit_With_Error
+                          ("Could not locate linker: " & L_Args.all (1).all);
+                     end if;
+
+                     --  The other arguments are passed as-is to the linker
+
+                     for J in 2 .. L_Args.all'Last loop
+                        Gcc_Linker_Options.Increment_Last;
+                        Gcc_Linker_Options.Table
+                          (Gcc_Linker_Options.Last) :=
+                                             new String'(L_Args.all (J).all);
+                     end loop;
+                  end;
 
-                  if Linker_Path = null then
-                     Exit_With_Error
-                       ("Could not locate linker: " & Arg (8 .. Arg'Last));
+               elsif Arg'Length >= 6 and then Arg (1 .. 6) = "--GCC=" then
+                  if Arg'Length = 6 then
+                     Exit_With_Error ("Missing argument for --GCC=");
                   end if;
 
-               elsif Arg'Length > 6 and then Arg (1 .. 6) = "--GCC=" then
                   declare
                      Program_Args : constant Argument_List_Access :=
                                       Argument_String_To_List
@@ -1413,8 +1433,8 @@ procedure Gnatlink is
          Write_Line ("  -M         Create map file mainprog.map");
       end if;
 
-      Write_Line ("  --GCC=comp Use comp as the compiler");
-      Write_Line ("  --LINK=nam Use 'nam' for the linking rather than 'gcc'");
+      Write_Line ("  --GCC=comp Use 'comp' as the compiler rather than 'gcc'");
+      Write_Line ("  --LINK=lnk Use 'lnk' as the linker rather than 'gcc'");
       Write_Eol;
       Write_Line ("  [non-Ada-objects]  list of non Ada object files");
       Write_Line ("  [linker-options]   other options for the linker");