comp.lang.ada
 help / color / mirror / Atom feed
From: jan.de.kruyf@gmail.com
Subject: Re: gnat compiler issues with a partial build
Date: Wed, 10 Jun 2015 13:36:06 -0700 (PDT)
Date: 2015-06-10T13:36:06-07:00	[thread overview]
Message-ID: <f4e0409c-f820-4461-979a-e42865d87adf@googlegroups.com> (raw)
In-Reply-To: <lylhfrmra2.fsf@pushface.org>

On Wednesday, June 10, 2015 at 7:01:26 PM UTC+2, Simon Wright wrote:


> 
> > You need to be careful about the Ada features you use in the RTS. Stick
> > to Ada95, only include packages under Ada, Interfaces, and GNAT.
> 
> and of course System.

Yes Simon, but this is not where the problem originates. Sure this is how it should be done once a person gets there, but at the moment I am still trying to find out how to proceed from "bare metal Ada" with no runtime at all to some small runtime that will work in the kernel.

So for the time being I have the "runtime" as part of the project and I basically use the ada compiler as a "small language compiler" without all the trappings.

Now the gnat compiler looks for certain symbols (read: routines to call) when it is compiling. Example: for NEW it needs "__gnat_malloc" to get some memory from the pool or heap.
So there will a 'U __gnat_malloc' in the object file for any package where you asked for 'NEW'

In your runtime the 'System.Memory' package  has 
pragma Export (C, Alloc, "__gnat_malloc");

And in the final full linking phase these two are matched, and your program will call that routine when it needs memory off the heap.

This holds true for all Unknown symbols the compiler spits out. They will be found either in the runtime, and then you can find them back in the adainclude directory with grep. Or they are in some included systemlib.

So that is why it is important not to have systemlib calls in a setup where there are no system libs. And note on the side: I do not know if finalization perhaps needs some system lib!

So the bottom line is that if an unknown symbol is not "Pragma Exported" from the adainclude packages then you cannot use it if you have no systemlibs.

So then it is a feature in the language that cannot be used in that specific setup.


My issue is that no matter what I do in native, the compiler produces some unknown symols that _are_ exported by the full native runtime, but _not_ by zfp or ravenscar (but those are for small controllers in the gnat wold)

And Mark L found out that the arm cross compiler does not produce them, otherwise he would have unresolved symols which he has not. 
So I think this is at the moment the road to follow. Find out how the arm cross compiler compiles differently from the native compiler.


cheers, bedtime now.

j.







  reply	other threads:[~2015-06-10 20:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 11:12 gnat compiler issues with a partial build jan.de.kruyf
2015-06-04 19:03 ` Lucretia
2015-06-09  8:11   ` jan.de.kruyf
2015-06-09 10:21 ` Mark Lorenzen
2015-06-09 11:28   ` jan.de.kruyf
2015-06-09 13:03     ` Mark Lorenzen
2015-06-09 18:57       ` jan.de.kruyf
2015-06-10 10:11         ` Mark Lorenzen
2015-06-10 15:34           ` jan.de.kruyf
2015-06-10 16:59             ` Simon Wright
2015-06-10 17:01               ` Simon Wright
2015-06-10 20:36                 ` jan.de.kruyf [this message]
2015-06-11  5:01                   ` Simon Wright
2015-06-11 14:08                     ` jan.de.kruyf
2015-06-11 16:10 ` rrr.eee.27
2015-06-11 19:38   ` Simon Wright
2015-06-12 14:37     ` jan.de.kruyf
2015-06-12 15:05       ` Simon Wright
2015-06-12 15:12         ` jan.de.kruyf
2015-06-12 15:31   ` jan.de.kruyf
replies disabled

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