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

Laurent GUERBY laurent@guerby.net
Wed May 27 08:12:00 GMT 2009


On Thu, 2009-05-07 at 16:30 +0200, Arnaud Charlet wrote:
> Adding also Vincent in the loop, since he implement (in 2001!) this switch,
> after lots of discussion at AdaCore (under 9510-006...) and refined it
> later on, see below:
> 
> > On Thu, 2009-05-07 at 14:17 +0200, Laurent GUERBY wrote:
> > > On Thu, 2009-05-07 at 14:10 +0200, Arnaud Charlet wrote:
> > > > Actually that's not what we want: what we want is to have --GCC be
> > > > smarter and recognize that the compiler specified is "gcc" or "another
> > > > non GCC compiler", which would also solve this issue.
> > > 
> > > Ok if this was the idea behind the --GCC behaviour I believe it's easy
> > > to extend the current gnatlink --GCC check to accept "xgcc" as well
> > > as what it accepts now:
> > > 
> > > gcc/ada/gnatlink.adb:
> > > 
> > >                      if Program_Args.all (1).all /= Gcc.all then
> > >                         Gcc := new String'(Program_Args.all (1).all);
> > >                         Standard_Gcc := False;
> > >                      end if;
> > > 
> > > I will submit a new patch shortly, thanks for your help on this issue.
> > 
> > Here it is. 
> > 
> > I've not changed the documentation because in the light about what you
> > said about the intended semantics I think it covers xgcc as well
> > since it's gcc too :).
> 
> Right. Actually what was initially intended was to pass switches from the
> main ALI file if no --GCC is specified, or if --GCC specifies additional
> switches (so not just --GCC=<some-gcc>), and not as I misremembered to
> differenciate between "some gcc" and "non gcc compilers".
> 
> Now, that's NOT what Vincent implemented: originally he implemented a simple
> "if --GCC is passed, then do not read switches from ALI". Then later
> he modified to the current behavior by comparing between --GCC=xxx and the
> default gcc used by gnatlink (under our internal ticket H423-001), and
> documented this behavior at the same tim.
> 
> I'm not sure why though, and believe that the original suggestion is
> the right one.
> 
> So if we go back to the original intent (no additional switches specified in
> --GCC), that would solve this specific issue as far as I can see, but maybe
> there was a good reason why Vincent did things differently?
> 
> If not, then a possible patch would be something like:
> 
>    if Program_Args'Length > 1 then
>       Standard_Gcc := False;
>    end if;
> 
> instead of
> 
>    if Program_Args.all (1).all /= Gcc.all then
>       Gcc := new String'(Program_Args.all (1).all);
>       Standard_Gcc := False;
>    end if;

Did you mean the following?

We still need to update Gcc.all otherwise gnatlink won't call xgcc
unless I'm reading the code wrong.

Laurent

Index: gcc/ada/gnatlink.adb
===================================================================
--- gcc/ada/gnatlink.adb	(revision 147903)
+++ gcc/ada/gnatlink.adb	(working copy)
@@ -523,7 +523,10 @@
                   begin
                      if Program_Args.all (1).all /= Gcc.all then
                         Gcc := new String'(Program_Args.all (1).all);
-                        Standard_Gcc := False;
+
+                        if Program_Args.all'Length > 1 then
+                           Standard_Gcc := False;
+                        end if;
                      end if;
 
                      --  Set appropriate flags for switches passed





More information about the Gcc-patches mailing list