comp.lang.ada
 help / color / mirror / Atom feed
* What are the limitations imposed by GNAT without runtime?
@ 2007-10-09 16:28 Lucretia
  2007-10-09 20:10 ` anon
  0 siblings, 1 reply; 9+ messages in thread
From: Lucretia @ 2007-10-09 16:28 UTC (permalink / raw)


Hi,

I have just tested this again and it seems to work. Basically,
configure gnat with --target=i386-elf, build, it stops failing cos
there is no runtime. You can install and it gives you a gnat1 compiler
in  libexec/gcc/i386-elf/4.2.2/ and gnatbind in bin/.

You have to copy the basic system.ads file from the source archive to
lib/gcc/i386-elf/4.2.2/adainclude/.

This then allows you can use i386-elf-gcc -c to compile source files.
You can also use i386-elf-ld to link provided you supply a linker
script and you'll also need some startup code.

So, as a test I put the following code through the compiler just to
see if it compiled:

pragma No_Run_Time; -- This isn't in the manual, and I vaguely
remember something about it being removed, no errors/warnings though.

procedure Kernel is

  type Wah is (One, Two);

  S : String := Wah'Image(Wah'First);

begin
   null;
end Kernel;

gives the following error:

kernel.adb:7:20: construct not allowed in configurable run-time mode

What does this mean?

So, apart from tasking and exceptions, what other language constructs
cannot be used in this mode?

Thanks,
Luke.

P.S: I'll try not to be sarcastic ;D




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-09 16:28 What are the limitations imposed by GNAT without runtime? Lucretia
@ 2007-10-09 20:10 ` anon
  2007-10-10  4:39   ` Simon Wright
  2007-10-10 10:04   ` Lucretia
  0 siblings, 2 replies; 9+ messages in thread
From: anon @ 2007-10-09 20:10 UTC (permalink / raw)


--  The "Non Ada standard" aka the "GNAT obsolete" pragma statement
--  ( chapter 14.1 from the GNAT_RM.xxx ) 

pragma No_Run_Time ;

--  removes a number of RTL packages at link time but it also direct 
--  the compiler that these packages are no longer available. Such as 
--  "Ada.Text_IO" as well as some attributes/constructs such as 
--  "Image". So, when you use such attributes/constructs or RTL 
--  packages you will receive a compiler error, because you will have 
--  to build these in your RTL or a replacement routine.
--
--  As I suggest before look at those project, because they have had 
--  some of the same problems that you will run into and you can use 
--  their code to see how they solve the problem. 
--
--
--  Before begin this great task you need to know the complete features 
--  of Ada, the compiler and its limitations, the computer system, the 
--  processor assembly language as well as the hardware that is 
--  installed.  Also, with GCC 4.x Adacore altered the GNAT compiler for 
--  its Ada 2005 specification by adding some componts that can cause 
--  problems in creating Stand-Alone code such as a Kernel.
--


procedure Kernel is


  type Wah is ( One, Two ) ;

  -- ------------------------------------------------ --
  -- Simple function replaces the Image attribute for -- 
  -- Wah type                                         --
  -- ------------------------------------------------ --
  function Image_Wah ( V : Wah ) return String is

    begin -- Image_Wah

      if V = One then
        return "One" ;
      else
        return "Two" ;
      end if ;

    end Image_Wah ;


  S : String := Image_Wah ( Wah'First ) ;


begin
  null ;
end Kernel ;


In <1191947316.791605.8420@50g2000hsm.googlegroups.com>,  Lucretia <lucretia9@lycos.co.uk> writes:
>Hi,
>
>I have just tested this again and it seems to work. Basically,
>configure gnat with --target=i386-elf, build, it stops failing cos
>there is no runtime. You can install and it gives you a gnat1 compiler
>in  libexec/gcc/i386-elf/4.2.2/ and gnatbind in bin/.
>
>You have to copy the basic system.ads file from the source archive to
>lib/gcc/i386-elf/4.2.2/adainclude/.
>
>This then allows you can use i386-elf-gcc -c to compile source files.
>You can also use i386-elf-ld to link provided you supply a linker
>script and you'll also need some startup code.
>
>So, as a test I put the following code through the compiler just to
>see if it compiled:
>
>pragma No_Run_Time; -- This isn't in the manual, and I vaguely
>remember something about it being removed, no errors/warnings though.
>
>procedure Kernel is
>
>  type Wah is (One, Two);
>
>  S : String := Wah'Image(Wah'First);
>
>begin
>   null;
>end Kernel;
>
>gives the following error:
>
>kernel.adb:7:20: construct not allowed in configurable run-time mode
>
>What does this mean?
>
>So, apart from tasking and exceptions, what other language constructs
>cannot be used in this mode?
>
>Thanks,
>Luke.
>
>P.S: I'll try not to be sarcastic ;D
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-09 20:10 ` anon
@ 2007-10-10  4:39   ` Simon Wright
  2007-10-10 10:07     ` Lucretia
  2007-10-10 10:04   ` Lucretia
  1 sibling, 1 reply; 9+ messages in thread
From: Simon Wright @ 2007-10-10  4:39 UTC (permalink / raw)


anon@anon.org (anon) writes:

> Before begin this great task you need to know the complete features
> of Ada, the compiler and its limitations, the computer system, the
> processor assembly language as well as the hardware that is
> installed.

OP will find out a lot about these topics by just starting and seeing
where it leads. I imagine this is the plan!



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-09 20:10 ` anon
  2007-10-10  4:39   ` Simon Wright
@ 2007-10-10 10:04   ` Lucretia
  2007-10-10 17:51     ` anon
  1 sibling, 1 reply; 9+ messages in thread
From: Lucretia @ 2007-10-10 10:04 UTC (permalink / raw)


> procedure Kernel is
>
>   type Wah is ( One, Two ) ;
>
>   -- ------------------------------------------------ --
>   -- Simple function replaces the Image attribute for --
>   -- Wah type                                         --
>   -- ------------------------------------------------ --
>   function Image_Wah ( V : Wah ) return String is
>
>     begin -- Image_Wah
>
>       if V = One then
>         return "One" ;
>       else
>         return "Two" ;
>       end if ;
>
>     end Image_Wah ;

This isn't much of an option as the compiler already creates the
strings for these in the data section. I'm not sure if these 2 other
strings would be created again or not.

Luke.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-10  4:39   ` Simon Wright
@ 2007-10-10 10:07     ` Lucretia
  0 siblings, 0 replies; 9+ messages in thread
From: Lucretia @ 2007-10-10 10:07 UTC (permalink / raw)


On Oct 10, 5:39 am, Simon Wright <simon.j.wri...@mac.com> wrote:
> a...@anon.org (anon) writes:
> > Before begin this great task you need to know the complete features
> > of Ada, the compiler and its limitations, the computer system, the
> > processor assembly language as well as the hardware that is
> > installed.
>
> OP will find out a lot about these topics by just starting and seeing
> where it leads. I imagine this is the plan!

True, but it doesn't hurt to find out if anybody knows what these are
to start with.

Luke.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-10 10:04   ` Lucretia
@ 2007-10-10 17:51     ` anon
  2007-10-10 19:00       ` Lucretia
  0 siblings, 1 reply; 9+ messages in thread
From: anon @ 2007-10-10 17:51 UTC (permalink / raw)


Actually, the string names for the type Wah does not exist if you use the 
"pragma NO_RUN_TIME". The compiler does not generated the code. So in 
order to do a "type-to-string" conversion you will have to build a 
function. That actually replaces the function that is use for attribute 
"IMAGE". And in that function the string names will exist.  Just like if you 
need the IMAGE attribute for a numeric object you will need to build a 
function to convert that numeric data to a string data. 

  To test this type:   "gnat compile kernel.adb -S" 
  Then check the file: "kernel.s"

    You will see that without the "pragma NO_RUN_TIME" statement 
    there is a data string of "ONETWO" which can be use by IMAGE 
    attribute.  But with the pragma the string "ONETWO" is 
    removed as well as the code that uses the data string, so 
    you have to build your own version.

Now in my answer I provide an example function based on your type with 
two objects. If you had a type with more than a couple of objects, then
you might want to use an array with the type value as part of the index 
algorithm to that array. 


This is one of the problems using the "pragma NO_RUN_TIME ;" 
statement! Which became obsolescent after GNAT 3.15P . 


From the GNAT_RM 3.15P :

Implementation Defined Pragmas
******************************

 ...

`pragma No_Run_Time'
     Syntax:

          pragma No_Run_Time;

     This is a configuration pragma that makes sure the user code does
     not use nor need anything from the GNAT run time.  This is mostly
     useful in context where code certification is required.  Please
     consult the `GNAT Pro High-Integrity Edition User's Guide' for
     additional information.


Now, from the GCC 4.3 => GNAT_RM :

Chapter 14: Obsolescent Features                                    211

 14 Obsolescent Features

 This chapter describes features that are provided by GNAT, but are 
 considered obsolescent since there are preferred ways of achieving 
 the same effect. These features are provided solely for historical 
 compatibility purposes.

 14.1 pragma No Run Time

 The pragma No_Run_Time is used to achieve an affect similar to the 
 use of the "Zero Foot Print" configurable run time, but without 
 requiring a specially configured run time. The result of using this 
 pragma, which must be used for all units in a partition, is to 
 restrict the use of any language features requiring run-time support 
 code. The preferred usage is to use an appropriately configured 
 run-time that includes just those features that are to be made 
 accessible.



 <1192010655.057857.9760@k79g2000hse.googlegroups.com>,  Lucretia <lucretia9@lycos.co.uk> writes:
>> procedure Kernel is
>>
>>   type Wah is ( One, Two ) ;
>>
>>   -- ------------------------------------------------ --
>>   -- Simple function replaces the Image attribute for --
>>   -- Wah type                                         --
>>   -- ------------------------------------------------ --
>>   function Image_Wah ( V : Wah ) return String is
>>
>>     begin -- Image_Wah
>>
>>       if V = One then
>>         return "One" ;
>>       else
>>         return "Two" ;
>>       end if ;
>>
>>     end Image_Wah ;
>
>This isn't much of an option as the compiler already creates the
>strings for these in the data section. I'm not sure if these 2 other
>strings would be created again or not.
>
>Luke.
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-10 17:51     ` anon
@ 2007-10-10 19:00       ` Lucretia
  2007-10-10 19:24         ` Lucretia
  2007-10-11  3:05         ` anon
  0 siblings, 2 replies; 9+ messages in thread
From: Lucretia @ 2007-10-10 19:00 UTC (permalink / raw)


On Oct 10, 6:51 pm, a...@anon.org (anon) wrote:
>   To test this type:   "gnat compile kernel.adb -S"
>   Then check the file: "kernel.s"
>
>     You will see that without the "pragma NO_RUN_TIME" statement
>     there is a data string of "ONETWO" which can be use by IMAGE
>     attribute.  But with the pragma the string "ONETWO" is
>     removed as well as the code that uses the data string, so
>     you have to build your own version.

Well, the assembly doesn't give any ASCII representation, but doing an
objdump on the file does.

Basically, the pragma No_Run_Time definitely has no effect on gnat
4.2.2, the string is there with or without the pragma.

> Now in my answer I provide an example function based on your type with
> two objects. If you had a type with more than a couple of objects, then
> you might want to use an array with the type value as part of the index
> algorithm to that array.
>
> This is one of the problems using the "pragma NO_RUN_TIME ;"
> statement! Which became obsolescent after GNAT 3.15P .
>
> From the GNAT_RM 3.15P :

I really don't fancy trying to build an older gnat, especially on a 64
bit OS.

> Now, from the GCC 4.3 => GNAT_RM :
>
> Chapter 14: Obsolescent Features                                    211
>
[snip]
>  14.1 pragma No Run Time
>
>  The pragma No_Run_Time is used to achieve an affect similar to the
>  use of the "Zero Foot Print" configurable run time, but without

And this ZFP profile doesn't exist in the gcc-4.2.2 docs, it's
mentioned in 14.1, but that's all.

Luke.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-10 19:00       ` Lucretia
@ 2007-10-10 19:24         ` Lucretia
  2007-10-11  3:05         ` anon
  1 sibling, 0 replies; 9+ messages in thread
From: Lucretia @ 2007-10-10 19:24 UTC (permalink / raw)


On Oct 10, 8:00 pm, Lucretia <lucret...@lycos.co.uk> wrote:

>  14.1 pragma No Run Time
>
> >  The pragma No_Run_Time is used to achieve an affect similar to the
> >  use of the "Zero Foot Print" configurable run time, but without
>
> And this ZFP profile doesn't exist in the gcc-4.2.2 docs, it's
> mentioned in 14.1, but that's all.

On having a grep in the source, I found this in targparm.ads:

   --  The corresponding string constant is placed immediately at the
start
   --  of the private part of system.ads if is present, e.g. in the
form:

   --    Run_Time_Name : constant String := "Zero Footprint Run Time";

   --  the corresponding messages will look something like

   --    xxx not supported (Zero Footprint Run Time)


   Run_Time_Name_On_Target : Name_Id := No_Name;
   --  Set to appropriate names table entry Id value if a
Run_Time_Name
   --  string constant is defined in system.ads. This name is used
only
   --  for the configurable run-time case, and is used to parametrize
   --  messages that complain about non-supported run-time features.
   --  The name should contain only letters A-Z, digits 1-9, spaces,
   --  and underscores.

Dunno, if this'll work if I just take the standard system.ads from gcc/
ada and modify it.

There is also an entry in system.ads:

   Configurable_Run_Time     : constant Boolean := False;

which seems to refer to the Run_Time_Name_On_Target above.

Luke.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: What are the limitations imposed by GNAT without runtime?
  2007-10-10 19:00       ` Lucretia
  2007-10-10 19:24         ` Lucretia
@ 2007-10-11  3:05         ` anon
  1 sibling, 0 replies; 9+ messages in thread
From: anon @ 2007-10-11  3:05 UTC (permalink / raw)


You create a corrupt build.

First, delete *.o *.ali

Second, you use "gnat compile kernel.adb -S" this feature does 
not build the object file kernal.o

To build the object file must use either => "gnat compile kernel.adb -S"
                                            "gcc -c kernel.s" 

or go back and use                       => "gnat compile kernel.adb"

Then        => "gnat bind kernel.ali" or "gnatbind kernel.ali" 
followed by => "gnat link kernel.ali" or "gnatlink kernel.ali"

Then try objdump. You will not find "ONETWO" in the version that 
has "pragma NO_RUN_TIME ;"

As for then "Zero Foot Print" documentation, well in GNAT that seams 
to be based in the PRO version. The default for the compiler is in 
Targparm package, but can be altered by editing the System package. 


In <1192042858.495410.139280@d55g2000hsg.googlegroups.com>,  Lucretia <lucretia9@lycos.co.uk> writes:
>On Oct 10, 6:51 pm, a...@anon.org (anon) wrote:
>>   To test this type:   "gnat compile kernel.adb -S"
>>   Then check the file: "kernel.s"
>>
>>     You will see that without the "pragma NO_RUN_TIME" statement
>>     there is a data string of "ONETWO" which can be use by IMAGE
>>     attribute.  But with the pragma the string "ONETWO" is
>>     removed as well as the code that uses the data string, so
>>     you have to build your own version.
>
>Well, the assembly doesn't give any ASCII representation, but doing an
>objdump on the file does.
>
>Basically, the pragma No_Run_Time definitely has no effect on gnat
>4.2.2, the string is there with or without the pragma.
>
>> Now in my answer I provide an example function based on your type with
>> two objects. If you had a type with more than a couple of objects, then
>> you might want to use an array with the type value as part of the index
>> algorithm to that array.
>>
>> This is one of the problems using the "pragma NO_RUN_TIME ;"
>> statement! Which became obsolescent after GNAT 3.15P .
>>
>> From the GNAT_RM 3.15P :
>
>I really don't fancy trying to build an older gnat, especially on a 64
>bit OS.
>
>> Now, from the GCC 4.3 => GNAT_RM :
>>
>> Chapter 14: Obsolescent Features                                    211
>>
>[snip]
>>  14.1 pragma No Run Time
>>
>>  The pragma No_Run_Time is used to achieve an affect similar to the
>>  use of the "Zero Foot Print" configurable run time, but without
>
>And this ZFP profile doesn't exist in the gcc-4.2.2 docs, it's
>mentioned in 14.1, but that's all.
>
>Luke.
>




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-10-11  3:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-09 16:28 What are the limitations imposed by GNAT without runtime? Lucretia
2007-10-09 20:10 ` anon
2007-10-10  4:39   ` Simon Wright
2007-10-10 10:07     ` Lucretia
2007-10-10 10:04   ` Lucretia
2007-10-10 17:51     ` anon
2007-10-10 19:00       ` Lucretia
2007-10-10 19:24         ` Lucretia
2007-10-11  3:05         ` anon

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