From 33420a449faae383e5bee8594fc6f4a4cf9788f9 Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Thu, 7 Jul 2005 11:41:44 +0200 Subject: [PATCH] bindgen.adb (Gen_Output_File_C): When switch -a was specified... 2005-07-07 Vincent Celier * bindgen.adb (Gen_Output_File_C): When switch -a was specified, put the destructor/constructor attributes for final/init. * gnatbind.adb (Gnatbind): Allow -a to be used in conjunction with -C From-SVN: r101692 --- gcc/ada/bindgen.adb | 14 ++++++++++++-- gcc/ada/gnatbind.adb | 3 --- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index e37a386a9be..bd3867487c1 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -2522,8 +2522,18 @@ package body Bindgen is WBI (" (int, int, char, char, char, char,"); WBI (" const char *, const char *,"); WBI (" int, int, int, int, int);"); - WBI ("extern void " & Ada_Final_Name.all & " (void);"); - WBI ("extern void " & Ada_Init_Name.all & " (void);"); + + if Use_Pragma_Linker_Constructor then + WBI ("extern void " & Ada_Final_Name.all & + " (void) __attribute__((destructor));"); + WBI ("extern void " & Ada_Init_Name.all & + " (void) __attribute__((constructor));"); + + else + WBI ("extern void " & Ada_Final_Name.all & " (void);"); + WBI ("extern void " & Ada_Init_Name.all & " (void);"); + end if; + WBI ("extern void system__standard_library__adafinal (void);"); if not No_Main_Subprogram then diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb index cbd3ceabf6e..270d3342810 100644 --- a/gcc/ada/gnatbind.adb +++ b/gcc/ada/gnatbind.adb @@ -413,9 +413,6 @@ begin if Bind_Main_Program then Fail ("switch -a must be used in conjunction with -n or -Lxxx"); - elsif not Ada_Bind_File then - Fail ("switch -a cannot be used when C code is generated"); - elsif not Gnatbind_Supports_Auto_Init then Fail ("automatic initialisation of elaboration " & "not supported on this platform"); -- 2.30.2