[PATCH][Ada] Add option to gnatlink to fix gnat.dg on some platforms

Laurent GUERBY laurent@guerby.net
Thu May 7 10:30:00 GMT 2009


Hi,

As discussed with Eric here:

http://gcc.gnu.org/ml/gcc-patches/2009-04/msg01484.html

And recently mentionned again in the context of mips-linux the work on
Ada multilib showed a weakness on the way gnatlink offers control on its
uses of gcc to compile the binder generated file and link the
executable: currently the system gcc will be used instead of the just
built gcc for gnat.dg testing which breaks platforms where the
system gcc is not close enough to the built gcc (and with time this
means all systems).

The following is a patch to trunk to add an option to gnatlink dedicated
to solving this specific issue.

Tested on x86_64-linux:
http://gcc.gnu.org/ml/gcc-testresults/2009-05/msg00508.html

(And soon on mispel-linux.)

There might be better ways to solve this annoying issue, I'm open to
suggestions.

Laurent

2009-05-07  Laurent GUERBY <laurent@guerby.net>

	* gnatlink.adb: Add --XCC= option to gnatlink.
	* gnat_ugn.texi: Document gnatlink --XCC=.

	* lib/gnat.exp: Use gnatlink --XCC=.

-------------- next part --------------
Index: gcc/testsuite/lib/gnat.exp
===================================================================
--- gcc/testsuite/lib/gnat.exp	(revision 147218)
+++ gcc/testsuite/lib/gnat.exp	(working copy)
@@ -259,13 +259,13 @@
     if ![is_remote host] {
         set file [lookfor_file $tool_root_dir gnatmake]
         if { $file == "" } {
-    	set file [lookfor_file $tool_root_dir gcc/gnatmake]
+            set file [lookfor_file $tool_root_dir gcc/gnatmake]
         }
         if { $file != "" } {
-    	set root [file dirname $file]
-    	set CC "$file --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --LINK=$root/xgcc -B$root -margs";
+            set root [file dirname $file]
+            set CC "$file --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --XCC=$root/xgcc -B$root -margs";
         } else {
-    	set CC [transform gnatmake]
+            set CC [transform gnatmake]
         }
     } else {
         set CC [transform gnatmake]
Index: gcc/ada/gnat_ugn.texi
===================================================================
--- gcc/ada/gnat_ugn.texi	(revision 147218)
+++ gcc/ada/gnat_ugn.texi	(working copy)
@@ -8967,6 +8967,11 @@
 @option{--GCC="foo -x -y" --GCC="bar -z -t"} is equivalent to
 @option{--GCC="bar -x -y -z -t"}.
 
+@item --XCC=@var{compiler_name}
+@cindex @option{--XCC=compiler_name} (@command{gnatlink})
+Same as @option{--GCC=compiler_name} excepted that switches in
+the ALI files are always used to compile the binder generated source.
+
 @item --LINK=@var{name}
 @cindex @option{--LINK=} (@command{gnatlink})
 @var{name} is the name of the linker to be invoked. This is especially
Index: gcc/ada/gnatlink.adb
===================================================================
--- gcc/ada/gnatlink.adb	(revision 147218)
+++ gcc/ada/gnatlink.adb	(working copy)
@@ -514,7 +514,10 @@
                        ("Could not locate linker: " & Arg (8 .. Arg'Last));
                   end if;
 
-               elsif Arg'Length > 6 and then Arg (1 .. 6) = "--GCC=" then
+               elsif Arg'Length > 6 and then
+                 (Arg (1 .. 6) = "--GCC="
+                  or else Arg (1 .. 6) = "--XCC=")
+               then
                   declare
                      Program_Args : constant Argument_List_Access :=
                                       Argument_String_To_List
@@ -523,7 +526,9 @@
                   begin
                      if Program_Args.all (1).all /= Gcc.all then
                         Gcc := new String'(Program_Args.all (1).all);
-                        Standard_Gcc := False;
+                        if Arg (1 .. 6) = "--GCC=" then
+                           Standard_Gcc := False;
+                        end if;
                      end if;
 
                      --  Set appropriate flags for switches passed


More information about the Gcc-patches mailing list