* Restricted or no run time in Ada
@ 2008-01-02 19:19 Lucretia
2008-01-02 20:49 ` anon
0 siblings, 1 reply; 21+ messages in thread
From: Lucretia @ 2008-01-02 19:19 UTC (permalink / raw)
Hi,
I've posted this to the gcc ml as well, but I honestly don't think
I'll get anywhere with that so I'm posting it here as well.
I got a simple hello world style multiboot kernel working again
recently
and it has got me thinking about how I should be using GNAT.
Basically, I built a cross compiler for binutils and gcc to target
i386-elf (I will be wanting to play with other targets in the future,
e.g. mips-elf, arm-elf, sparc-elf, etc.). This gives me the following
toolset:
i386-elf-addr2line i386-elf-gcc i386-elf-gprof i386-elf-ranlib
i386-elf-ar i386-elf-gcc-4.2.2 i386-elf-ld i386-elf-
readelf
i386-elf-as i386-elf-gccbug i386-elf-nm i386-elf-size
i386-elf-c++filt i386-elf-gcov i386-elf-objcopy i386-elf-
strings
i386-elf-cpp i386-elf-gnatbind i386-elf-objdump i386-elf-strip
Which is fine enough as I can compile Ada sources with gcc.
Now to get my kernel to compile I originally used pragma No_Run_Time
which is now obsolete. I heard about the Zero Foot Print configurable
runtime but couldn't get it to compile some of the source files and I
couldn't figure out why.
I then tried to use the new Ada 2005 pragma Restrictions and put the
following in my gnat.adc:
-- Basic stuff.
pragma Restrictions(No_Obsolescent_Features);
pragma Restrictions(No_Exceptions);
pragma Restrictions(No_Recursion);
-- Memory management.
pragma Restrictions(No_Allocators);
pragma Restrictions(No_Local_Allocators);
pragma Restrictions(No_Unchecked_Deallocation);
--pragma Restrictions(No_);
-- Make sure we don't have tasking or any of it's features enabled.
pragma Restrictions(Max_Tasks => 0);
pragma Restrictions(No_Protected_Types);
pragma Restrictions(No_Delay);
pragma Restrictions(No_Task_Hierarchy);
pragma Restrictions(No_Abort_Statements);
pragma Restrictions(No_Implicit_Heap_Allocations);
pragma Restrictions(No_Asynchronous_Control);
I'm sure there are more I can use, I'm not sure about that.
Now, AFAIK I'm fairly sure I don't need to use the binder as that will
create a "main" including argc, argv, etc which you don't have in a
kernel (obviously), but I'm sure there are some elaborations that
aren't
being done that I *should* have.
I basically want to develop a microkernel that doesn't use the Ada
runtime as an executive, I know this is the usual route, but I don't
want to do that. An Ada runtime on top of my kernel is fine though.
So, am I going the right way about this? Or is there something else I
should be doing? Am I missing pragma's or using them wrong? Should I
really be building a minimal runtime such that I can use Ada minus
exceptions, tasking, etc?
Thanks,
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 19:19 Restricted or no run time in Ada Lucretia
@ 2008-01-02 20:49 ` anon
2008-01-02 21:33 ` Lucretia
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: anon @ 2008-01-02 20:49 UTC (permalink / raw)
Your going down the wrong path!
First, there is no "pragma" other than "pragma No_Run_Time;" that
will allow GNAT to build code without a runtime code. Even then,
the code is not ROM bootable.
Second, The Ada main procedure (Ada program) has no startup address
or routine that can be directly linked and make a kernel, that can be
executed by a ROM startup! You must use the BINDER process to build
that start code. But the "GNAT BIND" does not allow stand-alone aka
ROM bootable kernel.
The GNAT binder perform a number of steps, that have to be preform
to insure that the program will work properly. Such as:
1. Checks that a program is consistent [ RM 10 ].
2. Checks that an acceptable order of elaboration exists
for the program [ RM 10 ].
3. Generates a main program incorporating the given
elaboration order. This program is a small Ada package
(body and spec) that must be subsequently compiled
using the GNAT compiler.
4. Determines the set of object files required by the
given main program.
So, for Ada only code, you must write a new Ada binder to preform
those steps to build a stand-alone code. And create the main program
(describe in step 3) that allows ROM bootable programs..
Time allowed just to write and test as new binder 6 months at least!
Another way is to use existing Ada 95 code projects that are out there.
That you can download the source code and study how they got around
this. But this way mean no Ada only code, and does violates the Ada RM.
In <dcc6d7b5-fb5b-4096-a066-85f6168a094d@l1g2000hsa.googlegroups.com>, Lucretia <lucretia9@lycos.co.uk> writes:
>Hi,
>
>I've posted this to the gcc ml as well, but I honestly don't think
>I'll get anywhere with that so I'm posting it here as well.
>
>I got a simple hello world style multiboot kernel working again
>recently
>and it has got me thinking about how I should be using GNAT.
>
>Basically, I built a cross compiler for binutils and gcc to target
>i386-elf (I will be wanting to play with other targets in the future,
>e.g. mips-elf, arm-elf, sparc-elf, etc.). This gives me the following
>toolset:
>
>i386-elf-addr2line i386-elf-gcc i386-elf-gprof i386-elf-ranlib
>i386-elf-ar i386-elf-gcc-4.2.2 i386-elf-ld i386-elf-
>readelf
>i386-elf-as i386-elf-gccbug i386-elf-nm i386-elf-size
>i386-elf-c++filt i386-elf-gcov i386-elf-objcopy i386-elf-
>strings
>i386-elf-cpp i386-elf-gnatbind i386-elf-objdump i386-elf-strip
>
>Which is fine enough as I can compile Ada sources with gcc.
>
>Now to get my kernel to compile I originally used pragma No_Run_Time
>which is now obsolete. I heard about the Zero Foot Print configurable
>runtime but couldn't get it to compile some of the source files and I
>couldn't figure out why.
>
>I then tried to use the new Ada 2005 pragma Restrictions and put the
>following in my gnat.adc:
>
>-- Basic stuff.
>pragma Restrictions(No_Obsolescent_Features);
>pragma Restrictions(No_Exceptions);
>pragma Restrictions(No_Recursion);
>
>-- Memory management.
>pragma Restrictions(No_Allocators);
>pragma Restrictions(No_Local_Allocators);
>pragma Restrictions(No_Unchecked_Deallocation);
>--pragma Restrictions(No_);
>
>-- Make sure we don't have tasking or any of it's features enabled.
>pragma Restrictions(Max_Tasks => 0);
>pragma Restrictions(No_Protected_Types);
>pragma Restrictions(No_Delay);
>pragma Restrictions(No_Task_Hierarchy);
>pragma Restrictions(No_Abort_Statements);
>pragma Restrictions(No_Implicit_Heap_Allocations);
>pragma Restrictions(No_Asynchronous_Control);
>
>I'm sure there are more I can use, I'm not sure about that.
>
>Now, AFAIK I'm fairly sure I don't need to use the binder as that will
>create a "main" including argc, argv, etc which you don't have in a
>kernel (obviously), but I'm sure there are some elaborations that
>aren't
>being done that I *should* have.
>
>I basically want to develop a microkernel that doesn't use the Ada
>runtime as an executive, I know this is the usual route, but I don't
>want to do that. An Ada runtime on top of my kernel is fine though.
>
>So, am I going the right way about this? Or is there something else I
>should be doing? Am I missing pragma's or using them wrong? Should I
>really be building a minimal runtime such that I can use Ada minus
>exceptions, tasking, etc?
>
>Thanks,
>Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 20:49 ` anon
@ 2008-01-02 21:33 ` Lucretia
2008-01-03 3:50 ` anon
2008-01-02 22:23 ` Simon Wright
2008-01-04 14:15 ` Lucretia
2 siblings, 1 reply; 21+ messages in thread
From: Lucretia @ 2008-01-02 21:33 UTC (permalink / raw)
On Jan 2, 8:49 pm, a...@anon.org (anon) wrote:
> Your going down the wrong path!
>
> First, there is no "pragma" other than "pragma No_Run_Time;" that
> will allow GNAT to build code without a runtime code. Even then,
> the code is not ROM bootable.
That pragma is deprecated for a start.
Why wouldn't it be ROM bootable?
> Second, The Ada main procedure (Ada program) has no startup address
> or routine that can be directly linked and make a kernel, that can be
> executed by a ROM startup! You must use the BINDER process to build
> that start code. But the "GNAT BIND" does not allow stand-alone aka
> ROM bootable kernel.
In my test I create a simple bit of asm that gets called by grub and
then it boots into my main Ada application. I also link with LD.
> The GNAT binder perform a number of steps, that have to be preform
> to insure that the program will work properly. Such as:
> 1. Checks that a program is consistent [ RM 10 ].
True enough.
> 2. Checks that an acceptable order of elaboration exists
> for the program [ RM 10 ].
This was something I was worried about.
> 3. Generates a main program incorporating the given
> elaboration order. This program is a small Ada package
> (body and spec) that must be subsequently compiled
> using the GNAT compiler.
> 4. Determines the set of object files required by the
> given main program.
>
> So, for Ada only code, you must write a new Ada binder to preform
> those steps to build a stand-alone code. And create the main program
> (describe in step 3) that allows ROM bootable programs..
Or use the gnatbind as a base.
> Time allowed just to write and test as new binder 6 months at least!
>
> Another way is to use existing Ada 95 code projects that are out there.
> That you can download the source code and study how they got around
> this. But this way mean no Ada only code, and does violates the Ada RM.
MarteOS actually uses gnat, they have ported the compiler to their os.
I don't know if it uses gnatbind. Not sure of pragmas either.
How do big companies use GNAT to create ROM bootable applications
then?
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 20:49 ` anon
2008-01-02 21:33 ` Lucretia
@ 2008-01-02 22:23 ` Simon Wright
2008-01-02 23:06 ` Lucretia
2008-01-04 14:15 ` Lucretia
2 siblings, 1 reply; 21+ messages in thread
From: Simon Wright @ 2008-01-02 22:23 UTC (permalink / raw)
anon@anon.org (anon) writes:
> 3. Generates a main program incorporating the given
> elaboration order. This program is a small Ada package
> (body and spec) that must be subsequently compiled
> using the GNAT compiler.
> 4. Determines the set of object files required by the
> given main program.
Not necessarily a main program: see http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gnat_ugn_unw/Binding-with-Non_002dAda-Main-Programs.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 22:23 ` Simon Wright
@ 2008-01-02 23:06 ` Lucretia
2008-01-03 5:14 ` roderick.chapman
0 siblings, 1 reply; 21+ messages in thread
From: Lucretia @ 2008-01-02 23:06 UTC (permalink / raw)
On Jan 2, 10:23 pm, Simon Wright <simon.j.wri...@mac.com> wrote:
> a...@anon.org (anon) writes:
> > 3. Generates a main program incorporating the given
> > elaboration order. This program is a small Ada package
> > (body and spec) that must be subsequently compiled
> > using the GNAT compiler.
> > 4. Determines the set of object files required by the
> > given main program.
>
> Not necessarily a main program: seehttp://gcc.gnu.org/onlinedocs/gcc-4.1.0/gnat_ugn_unw/Binding-with-Non...
Ah yeah, forgot about that, thanks. Thing is, it still requires the
standard lib and the use of -nostdlib doesn't make any difference.
$ i386-elf-gnatbind -n -nostdlib -nostdinc mb_start.ali
i386-elf-gnatbind: Cannot find: s-stalib.ali
So, I don't know where to go from here.
Thanks,
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 21:33 ` Lucretia
@ 2008-01-03 3:50 ` anon
0 siblings, 0 replies; 21+ messages in thread
From: anon @ 2008-01-03 3:50 UTC (permalink / raw)
There are 100s of books on how an os is booted. More detailed than will
ever be posted here.
To boot a program by the Boot ROM or to use boot loader you must create
a program that loads at 0000:7C00 which is the address that all MBR will
be loaded and executed on x86 machines. GNAT can not build a MBR code
block. Plus, size of the MBR and its complete function depends of the
filesystem on that drive. Like under the FAT the size is limited to 512
bytes.
Commercial compilers have the options that allows the creation of the
MBR block aka startup code. Then appends this MBR to the main
procedure (program) during linking instead of using the normal Ada
startup code.
MaRTE and RTEMS appends two small assembly routines (MBR) to
startup the system. Then the ROM executes this MBR code which
later jumps to the Ada program.
Most big companies use a non-Ada MBR that boots the new kernel.
Some other companies rewrite the GNATBIND, and GNATLINK programs
since the normal GNATBIND create code that must be link to
"a-adaint.c" and other c routines that links the Ada startup code to an
existing OS.
Note: The GNATBIND and GNATLINK programs basically have not changed
since their creation. So, rebuilding might be as easy as patching and
recompiling the new source code.
For GNAT, unless you write an RTS you will not be able to use
"exception" or other main Ada lib routines which links to the OS.
In <699060d5-9968-4148-b8d6-801058e8f0fa@i12g2000prf.googlegroups.com>, Lucretia <lucretia9@lycos.co.uk> writes:
>On Jan 2, 8:49 pm, a...@anon.org (anon) wrote:
>> Your going down the wrong path!
>>
>> First, there is no "pragma" other than "pragma No_Run_Time;" that
>> will allow GNAT to build code without a runtime code. Even then,
>> the code is not ROM bootable.
>
>That pragma is deprecated for a start.
>
>Why wouldn't it be ROM bootable?
>
>> Second, The Ada main procedure (Ada program) has no startup address
>> or routine that can be directly linked and make a kernel, that can be
>> executed by a ROM startup! You must use the BINDER process to build
>> that start code. But the "GNAT BIND" does not allow stand-alone aka
>> ROM bootable kernel.
>
>In my test I create a simple bit of asm that gets called by grub and
>then it boots into my main Ada application. I also link with LD.
>
>> The GNAT binder perform a number of steps, that have to be preform
>> to insure that the program will work properly. Such as:
>> 1. Checks that a program is consistent [ RM 10 ].
>
>True enough.
>
>> 2. Checks that an acceptable order of elaboration exists
>> for the program [ RM 10 ].
>
>This was something I was worried about.
>
>> 3. Generates a main program incorporating the given
>> elaboration order. This program is a small Ada package
>> (body and spec) that must be subsequently compiled
>> using the GNAT compiler.
>> 4. Determines the set of object files required by the
>> given main program.
>>
>> So, for Ada only code, you must write a new Ada binder to preform
>> those steps to build a stand-alone code. And create the main program
>> (describe in step 3) that allows ROM bootable programs..
>
>Or use the gnatbind as a base.
>
>> Time allowed just to write and test as new binder 6 months at least!
>>
>> Another way is to use existing Ada 95 code projects that are out there.
>> That you can download the source code and study how they got around
>> this. But this way mean no Ada only code, and does violates the Ada RM.
>
>MarteOS actually uses gnat, they have ported the compiler to their os.
>I don't know if it uses gnatbind. Not sure of pragmas either.
>
>How do big companies use GNAT to create ROM bootable applications
>then?
>
>Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 23:06 ` Lucretia
@ 2008-01-03 5:14 ` roderick.chapman
2008-01-03 7:30 ` Lucretia
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: roderick.chapman @ 2008-01-03 5:14 UTC (permalink / raw)
I have GNAT Pro 6.0.2 here. To get at the Zero Footprint
Profile, the documenation says:
1) Compile, bind and link with --RTS=zfp
2) You also need -nostdlib for the linker.
You should also really try to get a copy of the
"GNAT Pro User's Guide Supplement for
High-Integrity Edition Platforms" from AdaCore.
This is available to GNAT Pro customers, but I don't
think it's included in the GNAT GPL release.
Perhaps a polite request to AdaCore might yield results.
- Rod Chapman, Praxis
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 5:14 ` roderick.chapman
@ 2008-01-03 7:30 ` Lucretia
2008-01-03 8:00 ` Lucretia
2008-01-03 9:58 ` anon
2 siblings, 0 replies; 21+ messages in thread
From: Lucretia @ 2008-01-03 7:30 UTC (permalink / raw)
On Jan 3, 5:14 am, roderick.chap...@googlemail.com wrote:
> I have GNAT Pro 6.0.2 here. To get at the Zero Footprint
> Profile, the documenation says:
>
> 1) Compile, bind and link with --RTS=zfp
Is this a precompiled cut down version or does it do something
specific? If this is a precompiled version, this isn't available in
the free versions.
> 2) You also need -nostdlib for the linker.
I have actually managed to get somewhere using ZFP by copying over
system.ads and modifying it by hand (I originally tried this before
and came up with errors I didn't understand). I can now use i386-elf-
gcc to compile the source and i386-elf-gnatbind to bind the app (with
the -n parameter). I then link with i386-elf-ld and my startup calls
the adainit procedure.
Thing is, I don't actually need the adafinal procedure but I can't see
a way to not generate that, yet.
> You should also really try to get a copy of the
> "GNAT Pro User's Guide Supplement for
> High-Integrity Edition Platforms" from AdaCore.
>
> This is available to GNAT Pro customers, but I don't
> think it's included in the GNAT GPL release.
Yeah, it's not.
> Perhaps a polite request to AdaCore might yield results.
> - Rod Chapman, Praxis
Thanks,
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 5:14 ` roderick.chapman
2008-01-03 7:30 ` Lucretia
@ 2008-01-03 8:00 ` Lucretia
2008-01-03 8:40 ` Lucretia
2008-01-03 9:58 ` anon
2 siblings, 1 reply; 21+ messages in thread
From: Lucretia @ 2008-01-03 8:00 UTC (permalink / raw)
On Jan 3, 5:14 am, roderick.chap...@googlemail.com wrote:
> I have GNAT Pro 6.0.2 here. To get at the Zero Footprint
> Profile, the documenation says:
Also, the ZFP isn't really zero as it is possible to get the compiler
to generate stuff that's in the RT, i.e. I can't use -fstack-check as
it generates calls to _gnat_stack_check.
Thanks,
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 8:00 ` Lucretia
@ 2008-01-03 8:40 ` Lucretia
0 siblings, 0 replies; 21+ messages in thread
From: Lucretia @ 2008-01-03 8:40 UTC (permalink / raw)
Another thing that will complicate matters is not being able to use
the 'Image attribute:
mb_start.adb:21:20: construct not allowed in configurable run-time
mode
Also, for debugging, I'm going to want to be able to dump addresses to
the console/serial port AFAIK in GNAT you have to use a non-standard
package to get a string from a System.Address.
Thanks,
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 5:14 ` roderick.chapman
2008-01-03 7:30 ` Lucretia
2008-01-03 8:00 ` Lucretia
@ 2008-01-03 9:58 ` anon
2008-01-03 10:22 ` Lucretia
2 siblings, 1 reply; 21+ messages in thread
From: anon @ 2008-01-03 9:58 UTC (permalink / raw)
The "--RTS=zfp" just replaces the standard library path with "zfp"
path. The runtine directory and runtime code must exist inorder to
work. Those files are included in the PRO only.
Plus, I do not think this guy (a hobbist) wants to use the free GNAT
which MaRTE did. Instead of spending $14K per year for an Ada
compiler, when he could get one for a one time fee around $500
with complete documentation included.
In <bd291c9a-e51c-4efc-8de3-57174569904b@i12g2000prf.googlegroups.com>, roderick.chapman@googlemail.com writes:
>I have GNAT Pro 6.0.2 here. To get at the Zero Footprint
>Profile, the documenation says:
>
>1) Compile, bind and link with --RTS=zfp
>
>2) You also need -nostdlib for the linker.
>
>You should also really try to get a copy of the
>"GNAT Pro User's Guide Supplement for
>High-Integrity Edition Platforms" from AdaCore.
>
>This is available to GNAT Pro customers, but I don't
>think it's included in the GNAT GPL release.
>
>Perhaps a polite request to AdaCore might yield results.
> - Rod Chapman, Praxis
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 9:58 ` anon
@ 2008-01-03 10:22 ` Lucretia
2008-01-03 17:30 ` anon
0 siblings, 1 reply; 21+ messages in thread
From: Lucretia @ 2008-01-03 10:22 UTC (permalink / raw)
On Jan 3, 9:58 am, a...@anon.org (anon) wrote:
> The "--RTS=zfp" just replaces the standard library path with "zfp"
> path. The runtine directory and runtime code must exist inorder to
> work. Those files are included in the PRO only.
Yeah, exactly what I thought.
> Plus, I do not think this guy (a hobbist) wants to use the free GNAT
Why wouldn't I want to use the free GNAT?
> which MaRTE did. Instead of spending $14K per year for an Ada
> compiler, when he could get one for a one time fee around $500
> with complete documentation included.
$500 for GNAT?
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 10:22 ` Lucretia
@ 2008-01-03 17:30 ` anon
2008-01-03 20:05 ` Vadim Godunko
0 siblings, 1 reply; 21+ messages in thread
From: anon @ 2008-01-03 17:30 UTC (permalink / raw)
In <22a9c47e-bed4-40ed-9b6a-218655861989@k30g2000hse.googlegroups.com>, Lucretia <lucretia9@lycos.co.uk> writes:
>On Jan 3, 9:58 am, a...@anon.org (anon) wrote:
>> The "--RTS=zfp" just replaces the standard library path with "zfp"
>> path. The runtine directory and runtime code must exist inorder to
>> work. Those files are included in the PRO only.
>
>Yeah, exactly what I thought.
>
>> Plus, I do not think this guy (a hobbist) wants to use the free GNAT
>
>Why wouldn't I want to use the free GNAT?
Typo!
>
>> which MaRTE did. Instead of spending $14K per year for an Ada
>> compiler, when he could get one for a one time fee around $500
>> with complete documentation included.
>
>$500 for GNAT?
IBM, green hill and others vendors start their Ada compiler systems
around $500, of course it does go up from there but it is a one time
free unless you want extented support. The problem is to most that
those compilers are limited at the movement to Ada 95 specs.
GNAT (non-PRO) is the only one that is free and open source.
>
>Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 17:30 ` anon
@ 2008-01-03 20:05 ` Vadim Godunko
2008-01-03 20:22 ` Lucretia
0 siblings, 1 reply; 21+ messages in thread
From: Vadim Godunko @ 2008-01-03 20:05 UTC (permalink / raw)
On Jan 3, 8:30 pm, a...@anon.org (anon) wrote:
>
> GNAT (non-PRO) is the only one that is free and open source.
>
Yet another open source (under BSD license!) Ada compiler:
http://www.ten15.org/wiki/Ada
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 20:05 ` Vadim Godunko
@ 2008-01-03 20:22 ` Lucretia
2008-01-04 9:23 ` Maxim Reznik
2008-01-04 12:46 ` Georg Bauhaus
0 siblings, 2 replies; 21+ messages in thread
From: Lucretia @ 2008-01-03 20:22 UTC (permalink / raw)
On Jan 3, 8:05 pm, Vadim Godunko <vgodu...@gmail.com> wrote:
> On Jan 3, 8:30 pm, a...@anon.org (anon) wrote:
>
> > GNAT (non-PRO) is the only one that is free and open source.
>
> Yet another open source (under BSD license!) Ada compiler:
>
> http://www.ten15.org/wiki/Ada
Yes, I know of it. Incomplete (I don't know by how much though). Also,
a guy in #Ada has informed me the code generation is not great.
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 20:22 ` Lucretia
@ 2008-01-04 9:23 ` Maxim Reznik
2008-01-04 23:23 ` Brian May
2008-01-04 12:46 ` Georg Bauhaus
1 sibling, 1 reply; 21+ messages in thread
From: Maxim Reznik @ 2008-01-04 9:23 UTC (permalink / raw)
On Jan 3, 10:22 pm, Lucretia <lucret...@lycos.co.uk> wrote:
> Yes, I know of it. Incomplete (I don't know by how much though). Also,
> a guy in #Ada has informed me the code generation is not great.
>
What do guys at #Ada say about GNAT generated code?
An example:
procedure Test (X : in out Integer)
is
begin
X := X +
1;
end
Test;
--------------------------------------
GNAT:
_ada_test:
.LFB3:
pushl
%ebp
.LCFI0:
movl %esp,
%ebp
.LCFI1:
pushl
%ebx
.LCFI2:
subl $20,
%esp
.LCFI3:
movl 8(%ebp),
%eax
cltd
movl %eax,
%ecx
movl %edx,
%ebx
addl $1,
%ecx
adcl $0,
%ebx
movl %ecx,
%eax
movl %ebx,
%edx
addl $-2147483648,
%eax
adcl $0,
%edx
cmpl $0,
%edx
jbe .L6
movl $3,
4(%esp)
movl $.LC0,
(%esp)
call
__gnat_rcheck_10
.L6:
movl %ecx,
%eax
addl $20,
%esp
popl
%ebx
popl
%ebp
ret
--------------------------------------
Gela over ten15 (http://www.ten15.org/wiki/Ada) :
--------------------------------------
Test:
.set .Ldisp5,
0
movl 4+.Ldisp5(%esp),
%eax
incl
%eax
jno .L7
pushl
$7
movl __trans386_errhandler,
%eax
call *
%eax
.L7:
movl %eax,
4+.Ldisp5(%esp)
ret
--------------------------------------
Of course Gela project is far away of completion and not yet ready to
be
used in your project, but code it can generate for now not much worse
then one of others compilers.
--
Maxim Reznik
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-03 20:22 ` Lucretia
2008-01-04 9:23 ` Maxim Reznik
@ 2008-01-04 12:46 ` Georg Bauhaus
2008-01-04 13:53 ` Vadim Godunko
2008-01-04 14:13 ` Maxim Reznik
1 sibling, 2 replies; 21+ messages in thread
From: Georg Bauhaus @ 2008-01-04 12:46 UTC (permalink / raw)
On Fri, 2008-01-04 at 01:23 -0800, Maxim Reznik wrote:
> On Jan 3, 10:22 pm, Lucretia <lucret...@lycos.co.uk> wrote:
> > Yes, I know of it. Incomplete (I don't know by how much though). Also,
> > a guy in #Ada has informed me the code generation is not great.
> >
> What do guys at #Ada say about GNAT generated code?
$ objdump --disassemble test.o
test.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <_ada_test>:
0: 8d 47 01 lea 0x1(%rdi),%eax
3: c3 retq
$
For:
> procedure Test (X : in out Integer)
> is
> begin
> X := X +
> 1;
> end
> Test;
Have you instructed GNAT to not perform any kind of
optimization?
Is this an option using Gela? (For example, to verify
close correspondence of source and object code.)
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-04 12:46 ` Georg Bauhaus
@ 2008-01-04 13:53 ` Vadim Godunko
2008-01-04 14:13 ` Maxim Reznik
1 sibling, 0 replies; 21+ messages in thread
From: Vadim Godunko @ 2008-01-04 13:53 UTC (permalink / raw)
On Jan 4, 3:46 pm, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
>
> Have you instructed GNAT to not perform any kind of
> optimization?
>
> Is this an option using Gela? (For example, to verify
> close correspondence of source and object code.)
I have following assembler code, produced by GNAT GPL 2007 and GCC
GNAT 4.3.0 with size optimization and Ada semantic (don't forget
enable overflow checking!):
$ gcc -c -gnato -O2 test.adb
$ objdump --disassemble test.o
test.o: file format elf32-i386
Disassembly of section .text:
00000000 <_ada_test>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 14 sub $0x14,%esp
7: 8b 45 08 mov 0x8(%ebp),%eax
a: 89 c2 mov %eax,%edx
c: 89 c1 mov %eax,%ecx
e: c1 fa 1f sar $0x1f,%edx
11: 83 c1 01 add $0x1,%ecx
14: 89 d3 mov %edx,%ebx
16: 89 c8 mov %ecx,%eax
18: 83 d3 00 adc $0x0,%ebx
1b: 05 00 00 00 80 add $0x80000000,%eax
20: 89 da mov %ebx,%edx
22: 83 d2 00 adc $0x0,%edx
25: 83 fa 00 cmp $0x0,%edx
28: 76 16 jbe 40 <_ada_test+0x40>
2a: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
31: 00
32: c7 04 24 00 00 00 00 movl $0x0,(%esp)
39: e8 fc ff ff ff call 3a <_ada_test+0x3a>
3e: 66 90 xchg %ax,%ax
40: 89 c8 mov %ecx,%eax
42: 83 c4 14 add $0x14,%esp
45: 5b pop %ebx
46: 5d pop %ebp
47: c3 ret
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-04 12:46 ` Georg Bauhaus
2008-01-04 13:53 ` Vadim Godunko
@ 2008-01-04 14:13 ` Maxim Reznik
1 sibling, 0 replies; 21+ messages in thread
From: Maxim Reznik @ 2008-01-04 14:13 UTC (permalink / raw)
On 4 янв, 14:46, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
>
> Have you instructed GNAT to not perform any kind of
> optimization?
>
I used follow command:
gcc -S -gnato -O test.adb
In your listing there is no integer arithmetic overflow check,
required in ARM.
> Is this an option using Gela? (For example, to verify
> close correspondence of source and object code.)
Today most usable part of Gela is Gela-ASIS. This is target
independent ASIS implemented from scratch. It implement most of ASIS
for Ada 95 queries and 12 extension to support Ada 2005 according to
SI99 proposals.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-02 20:49 ` anon
2008-01-02 21:33 ` Lucretia
2008-01-02 22:23 ` Simon Wright
@ 2008-01-04 14:15 ` Lucretia
2 siblings, 0 replies; 21+ messages in thread
From: Lucretia @ 2008-01-04 14:15 UTC (permalink / raw)
I've documented it at my site: http://www.archeia.com/article-1199444859.html
and put up the source I used as a test.
Luke.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Restricted or no run time in Ada
2008-01-04 9:23 ` Maxim Reznik
@ 2008-01-04 23:23 ` Brian May
0 siblings, 0 replies; 21+ messages in thread
From: Brian May @ 2008-01-04 23:23 UTC (permalink / raw)
>>>>> "Maxim" == Maxim Reznik <reznikmm@gmail.com> writes:
Maxim> What do guys at #Ada say about GNAT generated code?
Not that I have read or understand the code in detail, but a small
procedure will have a lot overhead in setting up stack, arguments,
etc.
Try making it inline, I suspect that will reduce overhead...
--
Brian May <bam@snoopy.apana.org.au>
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2008-01-04 23:23 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-02 19:19 Restricted or no run time in Ada Lucretia
2008-01-02 20:49 ` anon
2008-01-02 21:33 ` Lucretia
2008-01-03 3:50 ` anon
2008-01-02 22:23 ` Simon Wright
2008-01-02 23:06 ` Lucretia
2008-01-03 5:14 ` roderick.chapman
2008-01-03 7:30 ` Lucretia
2008-01-03 8:00 ` Lucretia
2008-01-03 8:40 ` Lucretia
2008-01-03 9:58 ` anon
2008-01-03 10:22 ` Lucretia
2008-01-03 17:30 ` anon
2008-01-03 20:05 ` Vadim Godunko
2008-01-03 20:22 ` Lucretia
2008-01-04 9:23 ` Maxim Reznik
2008-01-04 23:23 ` Brian May
2008-01-04 12:46 ` Georg Bauhaus
2008-01-04 13:53 ` Vadim Godunko
2008-01-04 14:13 ` Maxim Reznik
2008-01-04 14:15 ` Lucretia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox