aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ada/mlib-fil.adb33
-rw-r--r--gcc/ada/mlib-fil.ads12
-rw-r--r--gcc/ada/mlib-tgt-aix.adb33
-rw-r--r--gcc/ada/mlib-tgt-darwin.adb77
-rw-r--r--gcc/ada/mlib-tgt-hpux.adb34
-rw-r--r--gcc/ada/mlib-tgt-irix.adb34
-rw-r--r--gcc/ada/mlib-tgt-linux.adb179
-rw-r--r--gcc/ada/mlib-tgt-lynxos.adb32
-rw-r--r--gcc/ada/mlib-tgt-mingw.adb33
-rw-r--r--gcc/ada/mlib-tgt-solaris.adb34
-rw-r--r--gcc/ada/mlib-tgt-tru64.adb34
-rw-r--r--gcc/ada/mlib-tgt-vxworks.adb34
12 files changed, 325 insertions, 244 deletions
diff --git a/gcc/ada/mlib-fil.adb b/gcc/ada/mlib-fil.adb
index cad1747..7af1bc2 100644
--- a/gcc/ada/mlib-fil.adb
+++ b/gcc/ada/mlib-fil.adb
@@ -35,14 +35,43 @@ package body MLib.Fil is
package Target renames MLib.Tgt;
+ ---------------
+ -- Append_To --
+ ---------------
+
+ function Append_To
+ (Filename : String;
+ Ext : String) return String
+ is
+ begin
+ if Ext'Length = 0 then
+ return Filename;
+
+ elsif Filename (Filename'Last) = '.' then
+ if Ext (Ext'First) = '.' then
+ return Filename & Ext (Ext'First + 1 .. Ext'Last);
+
+ else
+ return Filename & Ext;
+ end if;
+
+ else
+ if Ext (Ext'First) = '.' then
+ return Filename & Ext;
+
+ else
+ return Filename & '.' & Ext;
+ end if;
+ end if;
+ end Append_To;
+
------------
-- Ext_To --
------------
function Ext_To
(Filename : String;
- New_Ext : String := "")
- return String
+ New_Ext : String := "") return String
is
use Strings.Fixed;
diff --git a/gcc/ada/mlib-fil.ads b/gcc/ada/mlib-fil.ads
index 44460ca..3431dc7 100644
--- a/gcc/ada/mlib-fil.ads
+++ b/gcc/ada/mlib-fil.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2005, AdaCore --
+-- Copyright (C) 2001-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,9 +30,13 @@ package MLib.Fil is
function Ext_To
(Filename : String;
- New_Ext : String := "")
- return String;
- -- Return Filename with the extension change to New_Ext
+ New_Ext : String := "") return String;
+ -- Return Filename with the extension changed to New_Ext
+
+ function Append_To
+ (Filename : String;
+ Ext : String) return String;
+ -- Return Filename with the extension Ext
function Get_Ext (Filename : String) return String;
-- Return extension of filename
diff --git a/gcc/ada/mlib-tgt-aix.adb b/gcc/ada/mlib-tgt-aix.adb
index 86fd393..12fb469 100644
--- a/gcc/ada/mlib-tgt-aix.adb
+++ b/gcc/ada/mlib-tgt-aix.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, AdaCore --
+-- Copyright (C) 2003-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -138,7 +138,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- MLib.Fil.Ext_To (Lib_Filename, DLL_Ext);
+ MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
-- The file name of the library
Thread_Opts : Argument_List_Access := Empty_Argument_List;
@@ -276,7 +276,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -287,25 +288,22 @@ package body MLib.Tgt is
else
declare
Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
-
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -328,8 +326,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -338,10 +336,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-darwin.adb b/gcc/ada/mlib-tgt-darwin.adb
index 651f983..31f0308 100644
--- a/gcc/ada/mlib-tgt-darwin.adb
+++ b/gcc/ada/mlib-tgt-darwin.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,18 +30,29 @@
-- This is the Darwin version of the body
+with MLib; use MLib;
with MLib.Fil;
with MLib.Utl;
-with Namet; use Namet;
-with Opt;
-with Output; use Output;
+with Namet; use Namet;
+with Opt; use Opt;
+with Output; use Output;
with Prj.Com;
+
with System;
package body MLib.Tgt is
- use GNAT;
- use MLib;
+ Flat_Namespace : aliased String := "-Wl,-flat_namespace";
+ -- Instruct the linker to build the shared library as a flat
+ -- namespace image. The default is a two-level namespace image.
+
+ Shared_Libgcc : aliased String := "-shared-libgcc";
+
+ No_Shared_Libgcc_Options : aliased Argument_List :=
+ (1 => Flat_Namespace'Access);
+ With_Shared_Libgcc_Options : aliased Argument_List :=
+ (1 => Flat_Namespace'Access,
+ 2 => Shared_Libgcc'Access);
---------------------
-- Archive_Builder --
@@ -114,9 +125,10 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Filename, DLL_Ext);
+ Fil.Append_To (Lib_Filename, DLL_Ext);
+
+ Shared_Options : Argument_List_Access;
- Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
begin
@@ -125,28 +137,31 @@ package body MLib.Tgt is
Write_Line (Lib_File);
end if;
+ -- Invoke gcc with -shared-libgcc, but only for GCC 4 or higher
+
+ if GCC_Version >= 4 then
+ Shared_Options := With_Shared_Libgcc_Options'Access;
+ else
+ Shared_Options := No_Shared_Libgcc_Options'Access;
+ end if;
+
-- If specified, add automatic elaboration/finalization
if Lib_Version = "" then
Utl.Gcc
(Output_File => Lib_File,
Objects => Ofiles,
- Options => Options,
+ Options => Options & Shared_Options.all,
Driver_Name => Driver_Name,
Options_2 => Options_2);
else
- -- Instruct the linker to build the shared library as a flat
- -- namespace image, which is not the default. The default is a two
- -- level namespace image.
-
- Version_Arg := new String'("-Wl,-flat_namespace");
if Is_Absolute_Path (Lib_Version) then
Utl.Gcc
(Output_File => Lib_Version,
Objects => Ofiles,
- Options => Options & Version_Arg,
+ Options => Options & Shared_Options.all,
Driver_Name => Driver_Name,
Options_2 => Options_2);
Symbolic_Link_Needed := Lib_Version /= Lib_File;
@@ -155,7 +170,7 @@ package body MLib.Tgt is
Utl.Gcc
(Output_File => Lib_Dir & Directory_Separator & Lib_Version,
Objects => Ofiles,
- Options => Options & Version_Arg,
+ Options => Options & Shared_Options.all,
Driver_Name => Driver_Name,
Options_2 => Options_2);
Symbolic_Link_Needed :=
@@ -258,7 +273,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -268,25 +284,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -309,8 +323,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -318,10 +332,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-hpux.adb b/gcc/ada/mlib-tgt-hpux.adb
index 85e756c..985667d 100644
--- a/gcc/ada/mlib-tgt-hpux.adb
+++ b/gcc/ada/mlib-tgt-hpux.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, AdaCore --
+-- Copyright (C) 2003-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- MLib.Fil.Ext_To (Lib_Filename, DLL_Ext);
+ MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
@@ -256,7 +256,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -266,25 +267,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -307,8 +306,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -317,10 +316,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-irix.adb b/gcc/ada/mlib-tgt-irix.adb
index d7749a9..2df88ab 100644
--- a/gcc/ada/mlib-tgt-irix.adb
+++ b/gcc/ada/mlib-tgt-irix.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005, AdaCore --
+-- Copyright (C) 2003-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- MLib.Fil.Ext_To (Lib_Filename, DLL_Ext);
+ MLib.Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
@@ -294,7 +294,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -304,25 +305,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -345,8 +344,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -355,10 +354,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-linux.adb b/gcc/ada/mlib-tgt-linux.adb
index ca205b6..737a40a 100644
--- a/gcc/ada/mlib-tgt-linux.adb
+++ b/gcc/ada/mlib-tgt-linux.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -115,7 +115,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Filename, DLL_Ext);
+ Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
@@ -135,53 +135,104 @@ package body MLib.Tgt is
Options_2 => Options_2);
else
- Version_Arg := new String'("-Wl,-soname," & Lib_Version);
-
- if Is_Absolute_Path (Lib_Version) then
- Utl.Gcc
- (Output_File => Lib_Version,
- Objects => Ofiles,
- Options => Options & Version_Arg,
- Driver_Name => Driver_Name,
- Options_2 => Options_2);
- Symbolic_Link_Needed := Lib_Version /= Lib_File;
-
- else
- Utl.Gcc
- (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
- Objects => Ofiles,
- Options => Options & Version_Arg,
- Driver_Name => Driver_Name,
- Options_2 => Options_2);
- Symbolic_Link_Needed :=
- Lib_Dir & Directory_Separator & Lib_Version /= Lib_File;
- end if;
-
- if Symbolic_Link_Needed then
- declare
- Success : Boolean;
- Oldpath : String (1 .. Lib_Version'Length + 1);
- Newpath : String (1 .. Lib_File'Length + 1);
-
- Result : Integer;
- pragma Unreferenced (Result);
-
- function Symlink
- (Oldpath : System.Address;
- Newpath : System.Address) return Integer;
- pragma Import (C, Symlink, "__gnat_symlink");
-
- begin
- Oldpath (1 .. Lib_Version'Length) := Lib_Version;
- Oldpath (Oldpath'Last) := ASCII.NUL;
- Newpath (1 .. Lib_File'Length) := Lib_File;
- Newpath (Newpath'Last) := ASCII.NUL;
-
- Delete_File (Lib_File, Success);
-
- Result := Symlink (Oldpath'Address, Newpath'Address);
- end;
- end if;
+ declare
+ Maj_Version : constant String := Lib_Version;
+ Last_Maj : Positive := Maj_Version'Last;
+ Last : Positive;
+ Ok_Maj : Boolean := False;
+ begin
+ while Last_Maj > Maj_Version'First loop
+ if Maj_Version (Last_Maj) in '0' .. '9' then
+ Last_Maj := Last_Maj - 1;
+
+ else
+ Ok_Maj := Last_Maj /= Maj_Version'Last and then
+ Maj_Version (Last_Maj) = '.';
+
+ if Ok_Maj then
+ Last_Maj := Last_Maj - 1;
+ end if;
+
+ exit;
+ end if;
+ end loop;
+
+ if Ok_Maj then
+ Last := Last_Maj;
+
+ while Last > Maj_Version'First loop
+ if Maj_Version (Last) in '0' .. '9' then
+ Last := Last - 1;
+
+ else
+ Ok_Maj := Last /= Last_Maj and then
+ Maj_Version (Last) = '.';
+
+ if Ok_Maj then
+ Last := Last - 1;
+
+ Ok_Maj := Maj_Version (1 .. Last) = Lib_File;
+ end if;
+
+ exit;
+ end if;
+ end loop;
+ end if;
+
+ if Ok_Maj then
+ Version_Arg := new String'("-Wl,-soname," &
+ Maj_Version (1 .. Last_Maj));
+
+ else
+ Version_Arg := new String'("-Wl,-soname," & Lib_Version);
+ end if;
+
+ if Is_Absolute_Path (Lib_Version) then
+ Utl.Gcc
+ (Output_File => Lib_Version,
+ Objects => Ofiles,
+ Options => Options & Version_Arg,
+ Driver_Name => Driver_Name,
+ Options_2 => Options_2);
+ Symbolic_Link_Needed := Lib_Version /= Lib_File;
+
+ else
+ Utl.Gcc
+ (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
+ Objects => Ofiles,
+ Options => Options & Version_Arg,
+ Driver_Name => Driver_Name,
+ Options_2 => Options_2);
+ Symbolic_Link_Needed :=
+ Lib_Dir & Directory_Separator & Lib_Version /= Lib_File;
+ end if;
+
+ if Symbolic_Link_Needed then
+ declare
+ Success : Boolean;
+ Oldpath : String (1 .. Lib_Version'Length + 1);
+ Newpath : String (1 .. Lib_File'Length + 1);
+
+ Result : Integer;
+ pragma Unreferenced (Result);
+
+ function Symlink
+ (Oldpath : System.Address;
+ Newpath : System.Address) return Integer;
+ pragma Import (C, Symlink, "__gnat_symlink");
+
+ begin
+ Oldpath (1 .. Lib_Version'Length) := Lib_Version;
+ Oldpath (Oldpath'Last) := ASCII.NUL;
+ Newpath (1 .. Lib_File'Length) := Lib_File;
+ Newpath (Newpath'Last) := ASCII.NUL;
+
+ Delete_File (Lib_File, Success);
+
+ Result := Symlink (Oldpath'Address, Newpath'Address);
+ end;
+ end if;
+ end;
end if;
end Build_Dynamic_Library;
@@ -253,7 +304,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -263,25 +315,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -304,8 +354,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -314,10 +364,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-lynxos.adb b/gcc/ada/mlib-tgt-lynxos.adb
index 98fac43..4da0d4a 100644
--- a/gcc/ada/mlib-tgt-lynxos.adb
+++ b/gcc/ada/mlib-tgt-lynxos.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -184,7 +184,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -194,25 +195,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -235,8 +234,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -245,10 +244,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-mingw.adb b/gcc/ada/mlib-tgt-mingw.adb
index f350d2e..675f015 100644
--- a/gcc/ada/mlib-tgt-mingw.adb
+++ b/gcc/ada/mlib-tgt-mingw.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005, Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -119,7 +119,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator &
- Files.Ext_To (Lib_Filename, DLL_Ext);
+ Files.Append_To (Lib_Filename, DLL_Ext);
-- Start of processing for Build_Dynamic_Library
@@ -205,7 +205,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean is
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean is
begin
if not In_Tree.Projects.Table (Project).Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
@@ -214,25 +215,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- MLib.Fil.Ext_To (Lib_Name, Archive_Ext));
+ MLib.Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator &
- MLib.Fil.Ext_To (Lib_Name, DLL_Ext));
+ MLib.Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -254,8 +253,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
if In_Tree.Projects.Table (Project).Library_Kind =
@@ -263,11 +262,11 @@ package body MLib.Tgt is
then
Name_Len := 3;
Name_Buffer (1 .. Name_Len) := "lib";
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
Name_Len := 0;
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-solaris.adb b/gcc/ada/mlib-tgt-solaris.adb
index c97d0b1..a66753e 100644
--- a/gcc/ada/mlib-tgt-solaris.adb
+++ b/gcc/ada/mlib-tgt-solaris.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2006 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -111,7 +111,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Filename, DLL_Ext);
+ Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
@@ -250,7 +250,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -260,25 +261,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -301,8 +300,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -311,10 +310,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-tru64.adb b/gcc/ada/mlib-tgt-tru64.adb
index 33ed98b..a211d65 100644
--- a/gcc/ada/mlib-tgt-tru64.adb
+++ b/gcc/ada/mlib-tgt-tru64.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2002-2006 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -117,7 +117,7 @@ package body MLib.Tgt is
Lib_File : constant String :=
Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Filename, DLL_Ext);
+ Fil.Append_To (Lib_Filename, DLL_Ext);
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
@@ -260,7 +260,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -270,25 +271,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -311,8 +310,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -321,10 +320,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;
diff --git a/gcc/ada/mlib-tgt-vxworks.adb b/gcc/ada/mlib-tgt-vxworks.adb
index 69ed03b..b9e24af 100644
--- a/gcc/ada/mlib-tgt-vxworks.adb
+++ b/gcc/ada/mlib-tgt-vxworks.adb
@@ -7,7 +7,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2005 Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2006 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -179,6 +179,8 @@ package body MLib.Tgt is
return "sparc64";
elsif Target_Name (Target_Name'First .. Index) = "xscale" then
return "arm";
+ elsif Target_Name (Target_Name'First .. Index) = "i586" then
+ return "pentium";
else
return "";
end if;
@@ -225,7 +227,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
if not In_Tree.Projects.Table (Project).Library then
@@ -235,25 +238,23 @@ package body MLib.Tgt is
else
declare
- Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir);
+ Lib_Dir : constant String :=
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Dir);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
- Static
- then
+ if In_Tree.Projects.Table (Project).Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, Archive_Ext));
+ Fil.Append_To (Lib_Name, Archive_Ext));
else
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
- Fil.Ext_To (Lib_Name, DLL_Ext));
+ Fil.Append_To (Lib_Name, DLL_Ext));
end if;
end;
end if;
@@ -276,8 +277,8 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String
+ (In_Tree.Projects.Table (Project).Library_Name);
begin
Name_Len := 3;
@@ -286,10 +287,9 @@ package body MLib.Tgt is
if In_Tree.Projects.Table (Project).Library_Kind =
Static
then
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, Archive_Ext));
-
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, Archive_Ext));
else
- Add_Str_To_Name_Buffer (Fil.Ext_To (Lib_Name, DLL_Ext));
+ Add_Str_To_Name_Buffer (Fil.Append_To (Lib_Name, DLL_Ext));
end if;
return Name_Find;