https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79724

--- Comment #4 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
The current situation is the result of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=864
Comment 20 by Dave Korn (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=864#c20)
is spot on:

> ... means that it only recognizes a suffix if there is also a prefix, i.e. it 
> only
> works for cross-compilers.  The documentation suggests this is deliberate:
> [...]
> but why?  The native behaviour is wrong and it seems incorrect to me that
> it should have different semantics from the cross-compiler case.

As far as I can see, this comment from 2011 was never addressed, and the bug
was closed. This is what is biting us, this logic needs to be improved.

The simplest patch is to detect suffix in all cases, as far as I can see one
only needs to remove the test:


diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index cf39128fb7b..9a578a62273 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -2286,9 +2286,7 @@ package body Osint is
          end if;
       end loop;

-      if End_Of_Prefix > 1 then
-         Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;
-      end if;
+      Start_Of_Suffix := End_Of_Prefix + Prog'Length + 1;

       --  Create the new program name


And with this patch I get the expected result:

$ gnatmake-11 hello.adb     
gcc-11 -c hello.adb
gnatbind-11 -x hello.ali
gnatlink-11 hello.ali

Reply via email to