[COMMITTED,17/30] ada: Put back -G for binder

Message ID 20240801151738.400796-17-poulhies@adacore.com
State Committed
Commit f7c0f3a6cb8a87537047fd28c9ff50354c9f733c
Headers
Series [COMMITTED,01/30] ada: Remove obsolete workaround |

Commit Message

Marc Poulhiès Aug. 1, 2024, 3:17 p.m. UTC
  From: Arnaud Charlet <charlet@adacore.com>

gcc/ada/

	* bindgen.adb (Gen_Main): Put back support for -G
	* bindusg.adb (Display): Put back line for -G
	* opt.ads (CCG_Mode): Update doc
	* switch-b.adb (Scan_Binder_Switches): Put back support for -G

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/bindgen.adb  | 1 +
 gcc/ada/bindusg.adb  | 5 +++++
 gcc/ada/opt.ads      | 4 +++-
 gcc/ada/switch-b.adb | 6 ++++++
 4 files changed, 15 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index cdfaa08d8a6..57c97d966c9 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -2113,6 +2113,7 @@  package body Bindgen is
       if Bind_Main_Program
         and then not Minimal_Binder
         and then not CodePeer_Mode
+        and then not CCG_Mode
       then
          WBI ("      Ensure_Reference : aliased System.Address := " &
               "Ada_Main_Program_Name'Address;");
diff --git a/gcc/ada/bindusg.adb b/gcc/ada/bindusg.adb
index e870c5f0e22..855fd16c930 100644
--- a/gcc/ada/bindusg.adb
+++ b/gcc/ada/bindusg.adb
@@ -133,6 +133,11 @@  package body Bindusg is
       Write_Line
         ("  -F        Force checking of elaboration Flags");
 
+      --  Line for -G switch
+
+      Write_Line
+        ("  -G        Generate binder file suitable for CCG");
+
       --  Line for -h switch
 
       Write_Line
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index cc3723e1daa..dd0c8b38954 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -261,7 +261,9 @@  package Opt is
    --  (switch -B)
 
    CCG_Mode : Boolean := False;
-   --  Set to True when running as CCG (either via -gnatceg or via -emit-c)
+   --  GNAT, GNATBIND
+   --  Set to True when running as CCG (implicitly, via -emit-c, or -G for the
+   --  binder)
 
    Check_Aliasing_Of_Parameters : Boolean := False;
    --  GNAT
diff --git a/gcc/ada/switch-b.adb b/gcc/ada/switch-b.adb
index 7cc0b8f0e3d..729855bd5fe 100644
--- a/gcc/ada/switch-b.adb
+++ b/gcc/ada/switch-b.adb
@@ -362,6 +362,12 @@  package body Switch.B is
                Debugger_Level := 2;
             end if;
 
+         --  Processing for G switch
+
+         when 'G' =>
+            Ptr := Ptr + 1;
+            CCG_Mode := True;
+
          --  Processing for h switch
 
          when 'h' =>