aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2019-07-10 08:59:46 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-10 08:59:46 +0000
commit19448640ac04e980ef665ae72bc3f106b4e5b6e0 (patch)
tree20d634a5fcbf09b983aef0012360fa7828ee4d59 /gcc
parent3f833dc291c4ece5b7419e9dacf08b0831782693 (diff)
downloadgcc-19448640ac04e980ef665ae72bc3f106b4e5b6e0.zip
gcc-19448640ac04e980ef665ae72bc3f106b4e5b6e0.tar.gz
gcc-19448640ac04e980ef665ae72bc3f106b4e5b6e0.tar.bz2
[Ada] Elaboration order v4.0 and linker switches
This patch adds a missing functionality with respect to elaboration order v3.0. Units carry an attribute called Elab_Position which among other things controls the sorting of linker switches by gnatbind. Setting the proper position ensures the gnatbind will output the linker switches in an order compatible with what gnatlink expects. No simple test available as this requires a Windows cross-compiler. 2019-07-10 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * bindo-elaborators.adb (Elaborate_Units): Set attribute Elab_Position of all elaborated units. (Set_Unit_Elaboration_Positions): New routine. From-SVN: r273326
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/bindo-elaborators.adb26
2 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 4aa59b6..0973593 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * bindo-elaborators.adb (Elaborate_Units): Set attribute
+ Elab_Position of all elaborated units.
+ (Set_Unit_Elaboration_Positions): New routine.
+
2019-07-10 Gary Dismukes <dismukes@adacore.com>
* exp_util.adb: Reformatting and a typo fix.
diff --git a/gcc/ada/bindo-elaborators.adb b/gcc/ada/bindo-elaborators.adb
index 6d3a1e24..0d9f207 100644
--- a/gcc/ada/bindo-elaborators.adb
+++ b/gcc/ada/bindo-elaborators.adb
@@ -274,6 +274,10 @@ package body Bindo.Elaborators is
-- Determine whether vertex Vertex of library graph G is suitable for
-- weak elaboration.
+ procedure Set_Unit_Elaboration_Positions (Order : Unit_Id_Table);
+ pragma Inline (Set_Unit_Elaboration_Positions);
+ -- Set the ALI.Units positions of all elaboration units in order Order
+
procedure Trace_Component
(G : Library_Graph;
Comp : Component_Id;
@@ -750,6 +754,11 @@ package body Bindo.Elaborators is
if Status = Order_OK then
Validate_Elaboration_Order (Order);
+ -- Set attribute Elab_Position of table ALI.Units for all units in
+ -- the elaboration order.
+
+ Set_Unit_Elaboration_Positions (Order);
+
-- Output the dependencies among units when switch -e (output
-- complete list of elaboration order dependencies) is active.
@@ -1304,6 +1313,23 @@ package body Bindo.Elaborators is
and then Is_Weakly_Elaborable_Vertex (G, Vertex);
end Is_Suitable_Weakly_Elaborable_Vertex;
+ ------------------------------------
+ -- Set_Unit_Elaboration_Positions --
+ ------------------------------------
+
+ procedure Set_Unit_Elaboration_Positions (Order : Unit_Id_Table) is
+ U_Id : Unit_Id;
+
+ begin
+ for Position in Unit_Id_Tables.First ..
+ Unit_Id_Tables.Last (Order)
+ loop
+ U_Id := Order.Table (Position);
+
+ ALI.Units.Table (U_Id).Elab_Position := Position;
+ end loop;
+ end Set_Unit_Elaboration_Positions;
+
---------------------
-- Trace_Component --
---------------------