aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 12:25:28 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-11-19 12:25:28 +0100
commit5c2d8276da3cfaacdefb54bdd54644cc72fe7ab9 (patch)
treee6a56036a8cdb88c07612e74c0efc410508d8eb3 /gcc/ada
parentedbe49d1f936a259ff4f6b6fe7dbb5a52b6e947f (diff)
downloadgcc-5c2d8276da3cfaacdefb54bdd54644cc72fe7ab9.zip
gcc-5c2d8276da3cfaacdefb54bdd54644cc72fe7ab9.tar.gz
gcc-5c2d8276da3cfaacdefb54bdd54644cc72fe7ab9.tar.bz2
make.adb (Gnatmake): Invoke gnatlink with -shared-libgcc when gnatbind is invoked with -shared.
* make.adb (Gnatmake): Invoke gnatlink with -shared-libgcc when gnatbind is invoked with -shared. From-SVN: r90912
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/make.adb64
1 files changed, 38 insertions, 26 deletions
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 8260ebd..473c73c 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -357,9 +357,6 @@ package body Make is
-- added. Switch "-shared" is added if there is a non-static Library
-- Project File.
- Bind_Shared_Known : Boolean := False;
- -- Set to True after the first time Bind_Shared is computed
-
Shared_Libgcc : aliased String := "-shared-libgcc";
No_Shared_Libgcc_Switch : aliased Argument_List := (1 .. 0 => null);
@@ -3750,7 +3747,6 @@ package body Make is
Bind_Shared := No_Shared_Switch'Access;
Link_With_Shared_Libgcc := No_Shared_Libgcc_Switch'Access;
- Bind_Shared_Known := False;
Failed_Links.Set_Last (0);
Successful_Links.Set_Last (0);
@@ -3969,7 +3965,8 @@ package body Make is
Write_Eol;
Write_Str ("GNATMAKE ");
Write_Str (Gnatvsn.Gnat_Version_String);
- Write_Str (" Copyright 1995-2004 Free Software Foundation, Inc.");
+ Write_Eol;
+ Write_Str ("Copyright 1995-2004 Free Software Foundation, Inc.");
Write_Eol;
end if;
@@ -4958,32 +4955,47 @@ package body Make is
Last_Arg : Natural := Binder_Switches.Last;
-- Index of the last argument in Args
+ Shared_Libs : Boolean := False;
+ -- Set to True when there are shared library project files or
+ -- when gnatbind is invoked with -shared.
+
begin
- -- If it is the first time the bind step is performed,
- -- check if there are shared libraries, so that gnatbind is
- -- called with -shared.
+ -- Check if there are shared libraries, so that gnatbind is
+ -- called with -shared. Check also if gnatbind is called with
+ -- -shared, so that gnatlink is called with -shared-libgcc
+ -- for GCC version 3 and above, ensuring that the shared
+ -- version of libgcc will be used.
- if not Bind_Shared_Known then
- if Main_Project /= No_Project
- and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
- then
- for Proj in Projects.First .. Projects.Last loop
- if Projects.Table (Proj).Library and then
- Projects.Table (Proj).Library_Kind /= Static
- then
- Bind_Shared := Shared_Switch'Access;
+ if Main_Project /= No_Project
+ and then MLib.Tgt.Support_For_Libraries /= MLib.Tgt.None
+ then
+ for Proj in Projects.First .. Projects.Last loop
+ if Projects.Table (Proj).Library and then
+ Projects.Table (Proj).Library_Kind /= Static
+ then
+ Shared_Libs := True;
+ Bind_Shared := Shared_Switch'Access;
+ exit;
+ end if;
+ end loop;
+ end if;
- if GCC_Version >= 3 then
- Link_With_Shared_Libgcc :=
- Shared_Libgcc_Switch'Access;
- end if;
+ -- Check now for switch -shared
- exit;
- end if;
- end loop;
- end if;
+ if not Shared_Libs then
+ for J in Binder_Switches.First .. Last_Arg loop
+ if Binder_Switches.Table (J).all = "-shared" then
+ Shared_Libs := True;
+ exit;
+ end if;
+ end loop;
+ end if;
+
+ -- If there are shared libraries, invoke gnatlink with
+ -- -shared-libgcc if GCC version is 3 or more.
- Bind_Shared_Known := True;
+ if Shared_Libs and then GCC_Version >= 3 then
+ Link_With_Shared_Libgcc := Shared_Libgcc_Switch'Access;
end if;
-- Get all the binder switches