[COMMITTED,05/27] ada: Don't generate call of `System.Standard_Library.Adafinal`

Message ID 20250915130135.2720894-5-poulhies@adacore.com
State Committed
Commit 2c596157046519ea2420135ebae0601e5784c96e
Headers
Series [COMMITTED,01/27] ada: Fix documentation of Is_Ancestor_Package |

Commit Message

Marc Poulhiès Sept. 15, 2025, 1:01 p.m. UTC
  From: Vadim Godunko <godunko@adacore.com>

`adafinal` is not available on targets without standard library.

gcc/ada/ChangeLog:

	* bindgen.adb (Gen_Adafinal): Don't generate call of adafinal
	when use of standard library suppressed.

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

---
 gcc/ada/bindgen.adb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index 14367ebe97a7..24cc8dfb8990 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -476,7 +476,10 @@  package body Bindgen is
       --  but False for mains in other languages.) We do not want to do this if
       --  we're binding a library.
 
-      if not Bind_For_Library and not CodePeer_Mode then
+      if not Bind_For_Library
+        and not CodePeer_Mode
+        and not Suppress_Standard_Library_On_Target
+      then
          WBI ("      procedure s_stalib_adafinal;");
          Set_String ("      pragma Import (Ada, s_stalib_adafinal, ");
          Set_String ("""system__standard_library__adafinal"");");
@@ -505,7 +508,9 @@  package body Bindgen is
       --  on whether this is the main program or a library.
 
       if not CodePeer_Mode then
-         if not Bind_For_Library then
+         if not Bind_For_Library
+           and not Suppress_Standard_Library_On_Target
+         then
             WBI ("      s_stalib_adafinal;");
          elsif Lib_Final_Built then
             WBI ("      finalize_library;");