OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [ada/] [mlib-tgt-specific-hpux.adb] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                     M L I B . T G T . S P E C I F I C                    --
6
--                             (HP-UX Version)                              --
7
--                                                                          --
8
--                                 B o d y                                  --
9
--                                                                          --
10
--                     Copyright (C) 2003-2008, AdaCore                     --
11
--                                                                          --
12
-- GNAT is free software;  you can  redistribute it  and/or modify it under --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18
-- for  more details.  You should have  received  a copy of the GNU General --
19
-- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
20
-- http://www.gnu.org/licenses for a complete copy of the license.          --
21
--                                                                          --
22
-- GNAT was originally developed  by the GNAT team at  New York University. --
23
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
24
--                                                                          --
25
------------------------------------------------------------------------------
26
 
27
--  This is the HP-UX version of the body
28
 
29
with MLib.Fil;
30
with MLib.Utl;
31
with Opt;
32
with Output; use Output;
33
 
34
package body MLib.Tgt.Specific is
35
 
36
   --  Non default subprograms
37
 
38
   procedure Build_Dynamic_Library
39
     (Ofiles       : Argument_List;
40
      Options      : Argument_List;
41
      Interfaces   : Argument_List;
42
      Lib_Filename : String;
43
      Lib_Dir      : String;
44
      Symbol_Data  : Symbol_Record;
45
      Driver_Name  : Name_Id := No_Name;
46
      Lib_Version  : String  := "";
47
      Auto_Init    : Boolean := False);
48
 
49
   function DLL_Ext return String;
50
 
51
   function Is_Archive_Ext (Ext : String) return Boolean;
52
 
53
   ---------------------------
54
   -- Build_Dynamic_Library --
55
   ---------------------------
56
 
57
   procedure Build_Dynamic_Library
58
     (Ofiles       : Argument_List;
59
      Options      : Argument_List;
60
      Interfaces   : Argument_List;
61
      Lib_Filename : String;
62
      Lib_Dir      : String;
63
      Symbol_Data  : Symbol_Record;
64
      Driver_Name  : Name_Id := No_Name;
65
      Lib_Version  : String  := "";
66
      Auto_Init    : Boolean := False)
67
   is
68
      pragma Unreferenced (Interfaces);
69
      pragma Unreferenced (Symbol_Data);
70
      pragma Unreferenced (Auto_Init);
71
 
72
      Lib_File : constant String :=
73
                   "lib" & Fil.Append_To (Lib_Filename, DLL_Ext);
74
 
75
      Lib_Path : constant String :=
76
                   Lib_Dir & Directory_Separator & Lib_File;
77
 
78
      Version_Arg          : String_Access;
79
      Symbolic_Link_Needed : Boolean := False;
80
 
81
      Common_Options : constant Argument_List :=
82
                         Options & new String'(PIC_Option);
83
      --  Common set of options to the gcc command performing the link.
84
      --  On HPUX, this command eventually resorts to collect2, which may
85
      --  generate a C file and compile it on the fly. This compilation shall
86
      --  also generate position independent code for the final link to
87
      --  succeed.
88
   begin
89
      if Opt.Verbose_Mode then
90
         Write_Str ("building relocatable shared library ");
91
         Write_Line (Lib_Path);
92
      end if;
93
 
94
      if Lib_Version = "" then
95
         MLib.Utl.Gcc
96
           (Output_File => Lib_Path,
97
            Objects     => Ofiles,
98
            Options     => Common_Options,
99
            Options_2   => No_Argument_List,
100
            Driver_Name => Driver_Name);
101
 
102
      else
103
         declare
104
            Maj_Version : constant String :=
105
                            Major_Id_Name (Lib_File, Lib_Version);
106
         begin
107
            if Maj_Version'Length /= 0 then
108
               Version_Arg := new String'("-Wl,+h," & Maj_Version);
109
 
110
            else
111
               Version_Arg := new String'("-Wl,+h," & Lib_Version);
112
            end if;
113
 
114
            if Is_Absolute_Path (Lib_Version) then
115
               MLib.Utl.Gcc
116
                 (Output_File => Lib_Version,
117
                  Objects     => Ofiles,
118
                  Options     => Common_Options & Version_Arg,
119
                  Options_2   => No_Argument_List,
120
                  Driver_Name => Driver_Name);
121
               Symbolic_Link_Needed := Lib_Version /= Lib_Path;
122
 
123
            else
124
               MLib.Utl.Gcc
125
                 (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
126
                  Objects     => Ofiles,
127
                  Options     => Common_Options & Version_Arg,
128
                  Options_2   => No_Argument_List,
129
                  Driver_Name => Driver_Name);
130
               Symbolic_Link_Needed :=
131
                 Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path;
132
            end if;
133
 
134
            if Symbolic_Link_Needed then
135
               Create_Sym_Links
136
                 (Lib_Path, Lib_Version, Lib_Dir, Maj_Version);
137
            end if;
138
         end;
139
      end if;
140
   end Build_Dynamic_Library;
141
 
142
   -------------
143
   -- DLL_Ext --
144
   -------------
145
 
146
   function DLL_Ext return String is
147
   begin
148
      return "sl";
149
   end DLL_Ext;
150
 
151
   --------------------
152
   -- Is_Archive_Ext --
153
   --------------------
154
 
155
   function Is_Archive_Ext (Ext : String) return Boolean is
156
   begin
157
      return Ext = ".a" or else Ext = ".so";
158
   end Is_Archive_Ext;
159
 
160
begin
161
   Build_Dynamic_Library_Ptr := Build_Dynamic_Library'Access;
162
   DLL_Ext_Ptr := DLL_Ext'Access;
163
   Is_Archive_Ext_Ptr := Is_Archive_Ext'Access;
164
end MLib.Tgt.Specific;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.