1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2003-2005, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- This package allows the creation of symbol files to be used for linking
28 -- libraries. The format of symbol files depends on the platform, so there is
29 -- several implementations of the body.
31 with GNAT
.Dynamic_Tables
;
32 with GNAT
.OS_Lib
; use GNAT
.OS_Lib
;
40 -- Create a symbol file without considering any reference
43 -- Either create a symbol file with the same major and minor IDs if
44 -- all symbols are already found in the reference file or with an
45 -- incremented minor ID, if not.
48 -- Fail if symbols are not the same as those in the reference file
51 -- Restrict the symbols to those in the symbol file. Fail if some
52 -- symbols in the symbol file are not exported from the object files.
54 type Symbol_Kind
is (Data
, Proc
);
55 -- To distinguish between the different kinds of symbols
57 type Symbol_Data
is record
59 Kind
: Symbol_Kind
:= Data
;
60 Present
: Boolean := True;
62 -- Data (name and kind) for each of the symbols
64 package Symbol_Table
is new GNAT
.Dynamic_Tables
65 (Table_Component_Type
=> Symbol_Data
,
66 Table_Index_Type
=> Natural,
69 Table_Increment
=> 100);
72 Original_Symbols
: Symbol_Table
.Instance
;
73 -- The symbols, if any, found in the reference symbol table
75 Complete_Symbols
: Symbol_Table
.Instance
;
76 -- The symbols, if any, found in the objects files
79 (Symbol_File
: String;
81 Symbol_Policy
: Policy
;
84 Success
: out Boolean);
85 -- Initialize a symbol file. This procedure must be called before
86 -- Processing any object file. Depending on the platforms and the
87 -- circumstances, additional messages may be issued if Quiet is False.
91 -- This package, containing a single visible procedure Process, exists so
92 -- that it can be a subunits, for some platforms (such as VMS Alpha and
93 -- IA64), the body of package Symbols is common, while the subunit
97 (Object_File
: String;
98 Success
: out Boolean);
99 -- Get the symbols from an object file. Success is set to True if the
100 -- object file exists and has the expected format.
106 Success
: out Boolean);
107 -- Finalize the symbol file. This procedure should be called after
108 -- Initialize (once) and Process (one or more times). If Success is
109 -- True, the symbol file is written and closed, ready to be used for
110 -- linking the library. Depending on the platforms and the circumstances,
111 -- additional messages may be issued if Quiet is False.