* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
[official-gcc.git] / gcc / ada / lib-writ.ads
bloba2ec16a238a830b45ffa1bc9a226507c1bc8ef60
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- L I B . W R I T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
10 -- --
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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
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 ------------------------------------------------------------------------------
27 -- This package contains the routines for writing the library information
29 package Lib.Writ is
31 -----------------------------------
32 -- Format of Library Information --
33 -----------------------------------
35 -- Note: the contents of the ali file are summarized in the GNAT
36 -- user's guide, so if any non-trivial changes are made to this
37 -- section, they should be reflected in the user's guide.
39 -- This section describes the format of the library information that is
40 -- associated with object files. The exact method of this association is
41 -- potentially implementation dependent and is described and implemented
42 -- in package From the point of view of the description here, all we
43 -- need to know is that the information is represented as a string of
44 -- characters that is somehow associated with an object file, and can be
45 -- retrieved. If no library information exists for a given object file,
46 -- then we take this as equivalent to the non-existence of the object
47 -- file, as if source file has not been previously compiled.
49 -- The library information is written as a series of lines of the form:
51 -- Key_Character parameter parameter ...
53 ------------------
54 -- Header Lines --
55 ------------------
57 -- The initial header lines in the file give information about the
58 -- compilation environment, and identify other special information
59 -- such as main program parameters.
61 -- ----------------
62 -- -- V Version --
63 -- ----------------
65 -- V "xxxxxxxxxxxxxxxx"
67 -- This line indicates the library output version, as defined in
68 -- Gnatvsn. It ensures that separate object modules of a program are
69 -- consistent. It has to be changed if anything changes which would
70 -- affect successful binding of separately compiled modules.
71 -- Examples of such changes are modifications in the format of the
72 -- library info described in this package, or modifications to
73 -- calling sequences, or to the way that data is represented.
75 -- ---------------------
76 -- -- M Main Program --
77 -- ---------------------
79 -- M type [priority] [T=time-slice] W=?
81 -- This line appears only if the main unit for this file is
82 -- suitable for use as a main program. The parameters are:
84 -- type
86 -- P for a parameterless procedure
87 -- F for a function returning a value of integral type
88 -- (used for writing a main program returning an exit status)
90 -- priority
92 -- Present only if there was a valid pragma Priority in the
93 -- corresponding unit to set the main task priority. It is
94 -- an unsigned decimal integer.
96 -- T=time-slice
98 -- Present only if there was a valid pragma Time_Slice in the
99 -- corresponding unit. It is an unsigned decimal integer in
100 -- the range 0 .. 10**9 giving the time slice value in units
101 -- of milliseconds. The actual significance of this parameter
102 -- is target dependent.
104 -- W=?
106 -- This parameter indicates the wide character encoding
107 -- method used when compiling the main program file. The ?
108 -- character is the single character used in the -gnatW?
109 -- switch. This is used to provide the default wide-character
110 -- encoding for Wide_Text_IO files.
112 -- -----------------
113 -- -- A Argument --
114 -- -----------------
116 -- A argument
118 -- One of these lines appears for each of the arguments present
119 -- in the call to the gnat1 program. This can be used if it is
120 -- necessary to reconstruct this call (e.g. for fix and continue)
122 -- -------------------
123 -- -- P Parameters --
124 -- -------------------
126 -- P <<parameters>>
128 -- Indicates various information that applies to the compilation
129 -- of the corresponding source unit. Parameters is a sequence of
130 -- zero or more two letter codes that indicate configuration
131 -- pragmas and other parameters that apply:
133 -- Present if the unit uses tasking directly or indirectly and
134 -- has one or more valid xxx_Policy pragmas that apply to the unit.
135 -- The arguments are as follows:
137 -- CE Compilation errors. If this is present it means that the
138 -- ali file resulted from a compilation with the -gnatQ
139 -- switch set, and illegalities were detected. The ali
140 -- file contents may not be completely reliable, but the
141 -- format will be correct and complete. Note that NO is
142 -- always present if CE is present.
144 -- FD Configuration pragmas apply to all the units in this
145 -- file specifying a possibly non-standard floating point
146 -- format (VAX float with Long_Float using D_Float)
148 -- FG Configuration pragmas apply to all the units in this
149 -- file specifying a possibly non-standard floating point
150 -- format (VAX float with Long_Float using G_Float)
152 -- FI Configuration pragmas apply to all the units in this
153 -- file specifying a possibly non-standard floating point
154 -- format (IEEE Float)
156 -- Lx A valid Locking_Policy pragma applies to all the units
157 -- in this file, where x is the first character (upper case)
158 -- of the policy name (e.g. 'C' for Ceiling_Locking)
160 -- NO No object. This flag indicates that the units in this
161 -- file were not compiled to produce an object. This can
162 -- occur as a result of the use of -gnatc, or if no object
163 -- can be produced (e.g. when a package spec is compiled
164 -- instead of the body, or a subunit on its own).
166 -- NR No_Run_Time pragma in effect for all units in this file
168 -- NS Normalize_Scalars pragma in effect for all units in
169 -- this file
171 -- Qx A valid Queueing_Policy pragma applies to all the units
172 -- in this file, where x is the first character (upper case)
173 -- of the policy name (e.g. 'P' for Priority_Queueing).
175 -- Tx A valid Task_Dispatching_Policy pragma applies to all
176 -- the units in this file, where x is the first character
177 -- (upper case) of the corresponding policy name (e.g. 'F'
178 -- for FIFO_Within_Priorities).
180 -- UA Unreserve_All_Interrupts pragma was processed in one or
181 -- more units in this file
183 -- UX Generated code contains unit exception table pointer
184 -- (i.e. it uses zero-cost exceptions, and there is at
185 -- least one subprogram present).
187 -- ZX Units in this file use zero-cost exceptions and have
188 -- generated exception tables. If ZX is not present, the
189 -- longjmp/setjmp exception scheme is in use.
191 -- Note that language defined units never output policy (Lx,Tx,Qx)
192 -- parameters. Language defined units must correctly handle all
193 -- possible cases. These values are checked for consistency by the
194 -- binder and then copied to the generated binder output file.
196 -- ---------------------
197 -- -- R Restrictions --
198 -- ---------------------
200 -- R <<restriction-characters>>
202 -- This line records information regarding restrictions. The
203 -- parameter is a string of characters, one for each entry in
204 -- Restrict.Compilation_Unit_Restrictions, in order. There are
205 -- three settings possible settings for each restriction:
207 -- r Restricted. Unit was compiled under control of a pragma
208 -- Restrictions for the corresponding restriction. In
209 -- this case the unit certainly does not violate the
210 -- Restriction, since this would have been detected by
211 -- the compiler.
213 -- n Not used. The unit was not compiled under control of a
214 -- pragma Restrictions for the corresponding restriction,
215 -- and does not make any use of the referenced feature.
217 -- v Violated. The unit was not compiled under control of a
218 -- pragma Restrictions for the corresponding restriction,
219 -- and it does indeed use the referenced feature.
221 -- This information is used in the binder to check consistency,
222 -- i.e. to detect cases where one unit has "r" and another unit
223 -- has "v", which is not permitted, since these restrictions
224 -- are partition-wide.
226 ----------------------------
227 -- Compilation Unit Lines --
228 ----------------------------
230 -- Following these header lines, a set of information lines appears for
231 -- each compilation unit that appears in the corresponding object file.
232 -- In particular, when a package body or subprogram body is compiled,
233 -- there will be two sets of information, one for the spec and one for
234 -- the body. with the entry for the body appearing first. This is the
235 -- only case in which a single ALI file contains more than one unit (in
236 -- particular note that subunits do *not* count as compilation units for
237 -- this purpose, and generate no library information, since they are
238 -- inlined).
240 -- --------------------
241 -- -- U Unit Header --
242 -- --------------------
244 -- The lines for each compilation unit have the following form.
246 -- U unit-name source-name version <<attributes>>
248 -- This line identifies the unit to which this section of the
249 -- library information file applies. The first three parameters are
250 -- the unit name in internal format, as described in package Uname,
251 -- and the name of the source file containing the unit.
253 -- Version is the version given as eight hexadecimal characters
254 -- with upper case letters. This value is the exclusive or of the
255 -- source checksums of the unit and all its semantically dependent
256 -- units.
258 -- The <<attributes>> are a series of two letter codes indicating
259 -- information about the unit:
261 -- DE Dynamic Elaboration. This unit was compiled with the
262 -- dynamic elaboration model, as set by either the -gnatE
263 -- switch or pragma Elaboration_Checks (Dynamic).
265 -- EB Unit has pragma Elaborate_Body
267 -- EE Elaboration entity is present which must be set true when
268 -- the unit is elaborated. The name of the elaboration entity
269 -- is formed from the unit name in the usual way. If EE is
270 -- present, then this boolean must be set True as part of the
271 -- elaboration processing routine generated by the binder.
272 -- Note that EE can be set even if NE is set. This happens
273 -- when the boolean is needed solely for checking for the
274 -- case of access before elaboration.
276 -- GE Unit is a generic declaration, or corresponding body
278 -- IL Unit source uses a style with identifiers in all lower
279 -- IU case (IL) or all upper case (IU). If the standard mixed-
280 -- case usage is detected, or the compiler cannot determine
281 -- the style, then no I parameter will appear.
283 -- IS Initialize_Scalars pragma applies to this unit
285 -- KM Unit source uses a style with keywords in mixed case
286 -- KU (KM) or all upper case (KU). If the standard lower-case
287 -- usage is detected, or the compiler cannot determine the
288 -- style, then no K parameter will appear.
290 -- NE Unit has no elaboration routine. All subprogram bodies
291 -- and specs are in this category. Package bodies and specs
292 -- may or may not have NE set, depending on whether or not
293 -- elaboration code is required. Set if N_Compilation_Unit
294 -- node has flag Has_No_Elaboration_Code set.
296 -- PK Unit is package, rather than a subprogram
298 -- PU Unit has pragma Pure
300 -- PR Unit has pragma Preelaborate
302 -- RA Unit declares a Remote Access to Class-Wide (RACW) type
304 -- RC Unit has pragma Remote_Call_Interface
306 -- RT Unit has pragma Remote_Types
308 -- SP Unit has pragma Shared_Passive.
310 -- SU Unit is a subprogram, rather than a package
312 -- The attributes may appear in any order, separated by spaces.
314 -- ---------------------
315 -- -- W Withed Units --
316 -- ---------------------
318 -- Following each U line, is a series of lines of the form
320 -- W unit-name [source-name lib-name] [E] [EA] [ED]
322 -- One of these lines is present for each unit that is mentioned in
323 -- an explicit with clause by the current unit. The first parameter
324 -- is the unit name in internal format. The second parameter is the
325 -- file name of the file that must be compiled to compile this unit
326 -- (which is usually the file for the body, except for packages
327 -- which have no body). The third parameter is the file name of the
328 -- library information file that contains the results of compiling
329 -- this unit. The optional modifiers are used as follows:
331 -- E pragma Elaborate applies to this unit
333 -- EA pragma Elaborate_All applies to this unit
335 -- ED Elaborate_All_Desirable set for this unit, which means
336 -- that there is no Elaborate_All, but the analysis suggests
337 -- that Program_Error may be raised if the Elaborate_All
338 -- conditions cannot be satisfied. The binder will attempt
339 -- to treat ED as EA if it can.
341 -- The parameter source-name and lib-name are omitted for the case
342 -- of a generic unit compiled with earlier versions of GNAT which
343 -- did not generate object or ali files for generics.
345 -- -----------------------
346 -- -- L Linker_Options --
347 -- -----------------------
349 -- Following the W lines (if any, or the U line if not), are an
350 -- optional series of lines that indicates the usage of the pragma
351 -- Linker_Options in the associated unit. For each appearence of a
352 -- pragma Linker_Options (or Link_With) in the unit, a line is
353 -- present with the form:
355 -- L "string"
357 -- where string is the string from the unit line enclosed in quotes.
358 -- Within the quotes the following can occur:
360 -- c graphic characters in range 20-7E other than " or {
361 -- "" indicating a single " character
362 -- {hh} indicating a character whose code is hex hh (0-9,A-F)
363 -- {00} [ASCII.NUL] is used as a separator character
364 -- to separate multiple arguments of a single
365 -- Linker_Options pragma.
367 -- For further details, see Stringt.Write_String_Table_Entry. Note
368 -- that wide characters in the form {hhhh} cannot be produced, since
369 -- pragma Linker_Option accepts only String, not Wide_String.
371 -- The L lines are required to appear in the same order as the
372 -- corresponding Linker_Options (or Link_With) pragmas appear in
373 -- the source file, so that this order is preserved by the binder
374 -- in constructing the set of linker arguments.
376 ---------------------
377 -- Reference Lines --
378 ---------------------
380 -- The reference lines contain information about references from
381 -- any of the units in the compilation (including, body version
382 -- and version attributes, linker options pragmas and source
383 -- dependencies.
385 -- ------------------------------------
386 -- -- E External Version References --
387 -- ------------------------------------
389 -- One of these lines is present for each use of 'Body_Version or
390 -- 'Version in any of the units of the compilation. These are used
391 -- by the linker to determine which version symbols must be output.
392 -- The format is simply:
394 -- E name
396 -- where name is the external name, i.e. the unit name with either
397 -- a S or a B for spec or body version referenced (Body_Version
398 -- always references the body, Version references the Spec, except
399 -- in the case of a reference to a subprogram with no separate spec).
400 -- Upper half and wide character codes are encoded using the same
401 -- method as in Namet (Uhh for upper half, Whhhh for wide character,
402 -- where hh are hex digits).
404 -- ---------------------
405 -- -- D Dependencies --
406 -- ---------------------
408 -- The dependency lines indicate the source files on which the compiled
409 -- units depend. This is used by the binder for consistency checking.
410 -- These lines are also referenced by the cross-reference information.
412 -- D source-name time-stamp checksum [subunit-name] line:file-name
414 -- The time-stamp field contains the time stamp of the
415 -- corresponding source file. See types.ads for details on
416 -- time stamp representation.
418 -- The checksum is an 8-hex digit representation of the source
419 -- file checksum, with letters given in lower case.
421 -- The subunit name is present only if the dependency line is for
422 -- a subunit. It contains the fully qualified name of the subunit
423 -- in all lower case letters.
425 -- The line:file-name entry is present only if a Source_Reference
426 -- pragma appeared in the source file identified by source-name.
427 -- In this case, it gives the information from this pragma. Note
428 -- that this allows cross-reference information to be related back
429 -- to the original file. Note: the reason the line number comes
430 -- first is that a leading digit immediately identifies this as
431 -- a Source_Reference entry, rather than a subunit-name.
433 -- A line number of zero for line: in this entry indicates that
434 -- there is more than one source reference pragma. In this case,
435 -- the line numbers in the cross-reference are correct, and refer
436 -- to the original line number, but there is no information that
437 -- allows a reader of the ALI file to determine the exact mapping
438 -- of physical line numbers back to the original source.
440 -- Note: blank lines are ignored when the library information is
441 -- read, and separate sections of the file are separated by blank
442 -- lines to ease readability. Blanks between fields are also
443 -- ignored.
445 -- For entries corresponding to files that were not present (and
446 -- thus resulted in error messages), or for files that are not
447 -- part of the dependency set, both the time stamp and checksum
448 -- are set to all zero characters. These dummy entries are ignored
449 -- by the binder in dependency checking, but must be present for
450 -- proper interpretation of the cross-reference data.
452 --------------------------
453 -- Cross-Reference Data --
454 --------------------------
456 -- The cross-reference data follows the dependency lines. See
457 -- the spec of Lib.Xref for details on the format of this data.
459 -----------------
460 -- Subprograms --
461 -----------------
463 procedure Ensure_System_Dependency;
464 -- This procedure ensures that a dependency is created on system.ads.
465 -- Even if there is no semantic dependency, Targparm has read the
466 -- file to acquire target parameters, so we need a source dependency.
468 procedure Write_ALI (Object : Boolean);
469 -- This procedure writes the library information for the current main unit
470 -- The Object parameter is true if an object file is created, and false
471 -- otherwise.
473 -- Note: in the case where we are not generating code (-gnatc mode), this
474 -- routine only writes an ALI file if it cannot find an existing up to
475 -- date ALI file. If it *can* find an existing up to date ALI file, then
476 -- it reads this file and sets the Lib.Compilation_Arguments table from
477 -- the A lines in this file.
479 end Lib.Writ;