public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3750] [Ada] bindgen: support additional features on targets suppressing the standard lib
@ 2021-09-21 15:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-09-21 15:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0df911d9056437a79cf40fc643c49fced56574bd

commit r12-3750-g0df911d9056437a79cf40fc643c49fced56574bd
Author: Patrick Bernardi <bernardi@adacore.com>
Date:   Fri Jul 9 20:29:04 2021 +1000

    [Ada] bindgen: support additional features on targets suppressing the standard lib
    
    gcc/ada/
    
            * bindgen.adb (Gen_Adainit): For targets that suppress the
            standard library: set the default stack size global variable if
            a value is provided via the -d switch, and generate a call to
            __gnat_initialize_stack_limit if stack checking using stack
            limits is enabled.

Diff:
---
 gcc/ada/bindgen.adb | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index 0014f6a46da..049038b96e4 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -588,6 +588,27 @@ package body Bindgen is
             WBI ("");
          end if;
 
+         --  Import the default stack object if a size has been provided to the
+         --  binder.
+
+         if Opt.Default_Stack_Size /= Opt.No_Stack_Size then
+            WBI ("      Default_Stack_Size : Integer;");
+            WBI ("      pragma Import (C, Default_Stack_Size, " &
+                 """__gl_default_stack_size"");");
+         end if;
+
+         --  Initialize stack limit variable of the environment task if the
+         --  stack check method is stack limit and stack check is enabled.
+
+         if Stack_Check_Limits_On_Target
+           and then (Stack_Check_Default_On_Target or Stack_Check_Switch_Set)
+         then
+            WBI ("");
+            WBI ("      procedure Initialize_Stack_Limit;");
+            WBI ("      pragma Import (C, Initialize_Stack_Limit, " &
+                 """__gnat_initialize_stack_limit"");");
+         end if;
+
          if System_Secondary_Stack_Package_In_Closure then
             --  System.Secondary_Stack is in the closure of the program
             --  because the program uses the secondary stack or the restricted
@@ -619,6 +640,15 @@ package body Bindgen is
 
          WBI ("   begin");
 
+         --  Set the default stack size if provided to the binder
+
+         if Opt.Default_Stack_Size /= Opt.No_Stack_Size then
+            Set_String ("      Default_Stack_Size := ");
+            Set_Int (Default_Stack_Size);
+            Set_String (";");
+            Write_Statement_Buffer;
+         end if;
+
          if Main_Priority /= No_Main_Priority then
             Set_String ("      Main_Priority := ");
             Set_Int    (Main_Priority);
@@ -643,6 +673,7 @@ package body Bindgen is
          end if;
 
          if Main_Priority = No_Main_Priority
+           and then Opt.Default_Stack_Size = Opt.No_Stack_Size
            and then Main_CPU = No_Main_CPU
            and then not System_Tasking_Restricted_Stages_Used
          then


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-21 15:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 15:27 [gcc r12-3750] [Ada] bindgen: support additional features on targets suppressing the standard lib Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).