aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnarl
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-03-15 16:46:16 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-17 10:21:07 +0200
commitfc477a3f361dd5e72512e4ad42ef204af7c4c3e5 (patch)
tree2f48ef3ddeceeea42cce4a9bd5a1736435741d98 /gcc/ada/libgnarl
parent15b5a95d36a3c8cc35189aa951bdcdbf59ad4160 (diff)
downloadgcc-fc477a3f361dd5e72512e4ad42ef204af7c4c3e5.zip
gcc-fc477a3f361dd5e72512e4ad42ef204af7c4c3e5.tar.gz
gcc-fc477a3f361dd5e72512e4ad42ef204af7c4c3e5.tar.bz2
ada: Start the initialization of the tasking runtime earlier
This installs the tasking versions of the RTS_Lock manipulation routines very early, before the elaboration of all the Ada units of the program, including those of the runtime, because this elaboration may require the initialization of RTS_Lock objects. gcc/ada/ * bindgen.adb (Gen_Adainit): Generate declaration and call to the imported procedure __gnat_tasking_runtime_initialize if need be. * libgnat/s-soflin.ads (Locking Soft-Links): Add commentary. * libgnarl/s-tasini.adb (Tasking_Runtime_Initialize): New procedure exported as __gnat_tasking_runtime_initialize. Initialize RTS_Lock manipulation routines here instead of... (Init_RTS): ...here.
Diffstat (limited to 'gcc/ada/libgnarl')
-rw-r--r--gcc/ada/libgnarl/s-tasini.adb30
1 files changed, 21 insertions, 9 deletions
diff --git a/gcc/ada/libgnarl/s-tasini.adb b/gcc/ada/libgnarl/s-tasini.adb
index 2229414..794183f 100644
--- a/gcc/ada/libgnarl/s-tasini.adb
+++ b/gcc/ada/libgnarl/s-tasini.adb
@@ -102,10 +102,6 @@ package body System.Tasking.Initialization is
procedure Release_RTS_Lock (Addr : Address);
-- Release the RTS lock at Addr
- ------------------------
- -- Local Subprograms --
- ------------------------
-
----------------------------
-- Tasking Initialization --
----------------------------
@@ -116,6 +112,15 @@ package body System.Tasking.Initialization is
-- of initializing global locks, and installing tasking versions of certain
-- operations used by the compiler. Init_RTS is called during elaboration.
+ procedure Tasking_Runtime_Initialize;
+ pragma Export (Ada, Tasking_Runtime_Initialize,
+ "__gnat_tasking_runtime_initialize");
+ -- This procedure starts the initialization of the GNARL. It installs the
+ -- tasking versions of the RTS_Lock manipulation routines. It is called
+ -- very early before the elaboration of all the Ada units of the program,
+ -- including those of the runtime, because this elaboration may require
+ -- the initialization of RTS_Lock objects.
+
--------------------------
-- Change_Base_Priority --
--------------------------
@@ -414,11 +419,6 @@ package body System.Tasking.Initialization is
SSL.Task_Name := Task_Name'Access;
SSL.Get_Current_Excep := Get_Current_Excep'Access;
- SSL.Initialize_RTS_Lock := Initialize_RTS_Lock'Access;
- SSL.Finalize_RTS_Lock := Finalize_RTS_Lock'Access;
- SSL.Acquire_RTS_Lock := Acquire_RTS_Lock'Access;
- SSL.Release_RTS_Lock := Release_RTS_Lock'Access;
-
-- Initialize the tasking soft links (if not done yet) that are common
-- to the full and the restricted run times.
@@ -430,6 +430,18 @@ package body System.Tasking.Initialization is
Undefer_Abort (Environment_Task);
end Init_RTS;
+ --------------------------------
+ -- Tasking_Runtime_Initialize --
+ --------------------------------
+
+ procedure Tasking_Runtime_Initialize is
+ begin
+ SSL.Initialize_RTS_Lock := Initialize_RTS_Lock'Access;
+ SSL.Finalize_RTS_Lock := Finalize_RTS_Lock'Access;
+ SSL.Acquire_RTS_Lock := Acquire_RTS_Lock'Access;
+ SSL.Release_RTS_Lock := Release_RTS_Lock'Access;
+ end Tasking_Runtime_Initialize;
+
---------------------------
-- Locked_Abort_To_Level--
---------------------------