From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada to Ada Translator ? Date: Thu, 23 May 2019 08:56:29 +0100 Organization: A noiseless patient Spider Message-ID: References: <100ad407-090e-4316-9746-a4469568b53e@googlegroups.com> <64883feb-3e49-4c6a-855c-6673068e970c@googlegroups.com> <1bb467ae-6e2c-4fef-aaab-556a8df71747@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="050c443c50f1dfb0b3a49102ad6088c2"; logging-data="30266"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19q3X74c5DxUyrOd/eiIaPuV4HyLaWmzmM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (darwin) Cancel-Lock: sha1:NciH8KOKiSk/UR9uoNBhNq5FOME= sha1:Jzr1Kpiqxsy3p+qguJfYCEzv6l0= Xref: reader01.eternal-september.org comp.lang.ada:56376 Date: 2019-05-23T08:56:29+01:00 List-Id: foo wong writes: > So I guess where I was going with the pragmas, is that I would like to > be able to write Ada code that had tasking/exceptions etc but by the > time it reached gnat, these pragmas could be used to avoid linking to > any runtime from Adacore. You might be interested in a note I wrote about creating an RTS that can be used by the existing GNAT compiler; see [1], scroll down to 'RTS: second stage'. In my case, I was OK with a GPL/RLE runtime, so quite happy to modify existing FSF GCC files where they were useful; but I don't think there'd be any problem with reimplementing them. You might need to consider a 'clean room' approach (or not; IANAL). The sort of assumptions made by the compiler are that - for example, to create a Ravenscar task - there will exist a package System.Tasking.Restricted.Stages, containing (at GCC 8/9, GNAT CE 2018) procedure Create_Restricted_Task (Priority : Integer; Stack_Address : System.Address; Size : System.Parameters.Size_Type; Sec_Stack_Address : System.Secondary_Stack.SS_Stack_Ptr; Secondary_Stack_Size : System.Parameters.Size_Type; Task_Info : System.Task_Info.Task_Info_Type; CPU : Integer; State : Task_Procedure_Access; Discriminants : System.Address; Elaborated : Access_Boolean; Chain : in out Activation_Chain; Task_Image : String; Created_Task : Task_Id); I don't support exceptions, they're fearsomely complicated, and I don't believe that embedded software should rely on exceptions to provide continued execution past errors, and SPARK wouldn't allow them anyway. See notes at [2] - especially Robert Dewar's remarks linked to at the end. [1] https://forward-in-code.blogspot.com/2015/06/building-runtime-system-for-arm-eabi.html [2] https://github.com/simonjwright/cortex-gnat-rts/wiki/ExceptionHandling