comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Weird error emanating from GNAT binder: duplicat "gnatS"
Date: Thu, 23 Feb 2023 13:16:15 +0000	[thread overview]
Message-ID: <lyy1ooo734.fsf@pushface.org> (raw)
In-Reply-To: d87b4b85-48db-473f-b4d7-47d19d890fddn@googlegroups.com

Jerry <list_email@icloud.com> writes:

> On Wednesday, February 22, 2023 at 1:50:23 AM UTC-7, Jerry wrote:
>> On Tuesday, February 21, 2023 at 10:53:33 PM UTC-7, Niklas Holsti wrote: 
>
> I just remembered something that I forgot to mention. In December 2022
> I got a new MacBook Pro with an Apple M1 Pro CPU. Consequently, I
> installed Simon's ARM compiler from
> https://github.com/simonjwright/distributing-gcc/releases/tag/gcc-12.2.0-aarch64.
> When I restored common.adb and common.ads from backup, as I mentioned
> above after the problem appeared, I noticed that they were last edited
> in September 2022. Surely these files were recompiled with the new
> compiler in December 2022, right? Is it possible that I have been
> running old binaries for common.ads/b under the translator Rosetta 2
> without realizing it? That the new compiler decided that these files
> didn't need to be recompiled because it saw the old x86-64 binaries ?
> Or that these files were compiled for the first time with the new
> compiler only 2-3 days ago, revealing a compiler bug? To be clear, I
> have been running successfully, since December 2022, other main
> programs that link to common and its dependencies—I had no need to
> edit common until 2-3 days ago.

Building your downstream demo on M1 Mac Mini with gcc-12.2.0 (an x86_64
compiler running under Rosetta),

   $ /opt/gcc-12.2.0/bin/gnatmake test_gnats_problem.adb
   gcc -c test_gnats_problem.adb
   gcc -c common.adb
   gnatbind -x test_gnats_problem.ali
   gnatlink test_gnats_problem.ali
   $ file common.o
   common.o: Mach-O 64-bit object x86_64

Building with the aarch64 version of the same compiler,

   $ /opt/gcc-12.2.0-aarch64/bin/gnatmake test_gnats_problem
   gcc -c test_gnats_problem.adb
   gcc -c common.adb
   gnatbind -x test_gnats_problem.ali
   gnatlink test_gnats_problem.ali
   $ file common.o
   common.o: Mach-O 64-bit object arm64

and then rebuilding for x86_64,

   $ /opt/gcc-12.2.0/bin/gnatmake test_gnats_problem.adb
   gcc -c test_gnats_problem.adb
   gcc -c common.adb
   gnatbind -x test_gnats_problem.ali
   gnatlink test_gnats_problem.ali
   $ file common.o
   common.o: Mach-O 64-bit object x86_64

so the compiler recognises the change and recompiles (I think this is
because the date of g-os_lib.ads has changed, even though the checksum
hasn't).

The situation might be different if you compile with 'gnatmake -m'.

If you try to link with incompatible architectures, the linker will
refuse (as I just found when rebuilding alr using an x86_64 compiler,
when the previous build was with aarch64; in that case, the source that
led to the problem was unchanged, down to the file dates).

  reply	other threads:[~2023-02-23 13:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  0:11 Weird error emanating from GNAT binder: duplicat "gnatS" Jerry
2023-02-21 22:59 ` Jerry
2023-02-22  5:53   ` Niklas Holsti
2023-02-22  8:50     ` Jerry
2023-02-22  9:37       ` Jeffrey R.Carter
2023-02-22  9:49         ` Jerry
2023-02-22 14:26         ` Simon Wright
2023-02-23  6:34           ` Jerry
2023-02-23 12:57             ` Niklas Holsti
2023-02-24 20:22               ` Jeffrey R.Carter
2023-02-22  9:39       ` Jerry
2023-02-23 13:16         ` Simon Wright [this message]
2023-02-23 19:33           ` Jerry
2023-02-24  0:28             ` Jerry
2023-02-24  0:34               ` Jerry
2023-02-24  8:07                 ` R R
2023-02-26  5:30                   ` Jerry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox