PR binutils/11742
[binutils.git] / include / vms / lbr.h
blobbdb436aa70a7a092c89e81eae71b415ada45578f
1 /* Alpha VMS external format of Libraries.
3 Copyright 2010 Free Software Foundation, Inc.
4 Written by Tristan Gingold <gingold@adacore.com>, AdaCore.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
23 #ifndef _VMS_LBR_H
24 #define _VMS_LBR_H
26 /* Libray HeaDer. */
28 /* Magic numbers. Should match the major version. */
30 #define LHD_SANEID_DCX 319232342
31 #define LHD_SANEID3 233579905
32 #define LHD_SANEID6 233579911
34 /* Library type. */
35 #define LBR__C_TYP_UNK 0 /* Unknown / unspecified. */
36 #define LBR__C_TYP_OBJ 1 /* Vax object. */
37 #define LBR__C_TYP_MLB 2 /* Macro. */
38 #define LBR__C_TYP_HLP 3 /* Help. */
39 #define LBR__C_TYP_TXT 4 /* Text. */
40 #define LBR__C_TYP_SHSTB 5 /* Vax shareable image. */
41 #define LBR__C_TYP_NCS 6 /* NCS. */
42 #define LBR__C_TYP_EOBJ 7 /* Alpha object. */
43 #define LBR__C_TYP_ESHSTB 8 /* Alpha shareable image. */
44 #define LBR__C_TYP_IOBJ 9 /* IA-64 object. */
45 #define LBR__C_TYP_ISHSTB 10 /* IA-64 shareable image. */
47 struct vms_lhd
49 /* Type of the library. See above. */
50 unsigned char type;
52 /* Number of indexes. Generally 1, 2 for object libraries. */
53 unsigned char nindex;
55 unsigned char fill_1[2];
57 /* Sanity Id. */
58 unsigned char sanity[4];
60 /* Version. */
61 unsigned char majorid[2];
62 unsigned char minorid[2];
64 /* Tool name. */
65 unsigned char lbrver[32];
67 /* Create time. */
68 unsigned char credat[8];
70 /* Update time. */
71 unsigned char updtim[8];
73 /* Size of the MHD. */
74 unsigned char mhdusz;
76 unsigned char idxblkf[2]; /* Unused. */
77 unsigned char fill_2;
78 unsigned char closerror[2];
80 unsigned char spareword[2];
82 /* First free block, and number of free blocks. */
83 unsigned char freevbn[4];
84 unsigned char freeblk[4];
86 unsigned char nextrfa[6];
87 unsigned char nextvbn[4];
89 /* Free pre-allocated index block. */
90 unsigned char freidxblk[4];
91 unsigned char freeidx[4];
93 /* Highest pre-allocated index block and in use. */
94 unsigned char hipreal[4];
95 unsigned char hiprusd[4];
97 /* Number of index blocks in use. */
98 unsigned char idxblks[4];
100 /* Number of index entries. */
101 unsigned char idxcnt[4];
103 /* Number of modules entries. */
104 unsigned char modcnt[4];
106 unsigned char fill_3[2];
108 /* Number of module headers. */
109 unsigned char modhdrs[4];
111 /* Overhead index pointers. */
112 unsigned char idxovh[4];
114 /* Update history records. */
115 unsigned char maxluhrec[2];
116 unsigned char numluhrec[2];
117 unsigned char begluhrfa[6];
118 unsigned char endluhrfa[6];
120 /* DCX map. */
121 unsigned char dcxmapvbn[4];
123 unsigned char fill_4[4 * 13];
126 /* Known major ids. */
127 #define LBR_MAJORID 3 /* Alpha libraries. */
128 #define LBR_ELFMAJORID 6 /* Elf libraries (new index, new data). */
130 /* Offset of the first IDD. */
131 #define LHD_IDXDESC 196
133 /* InDex Description. */
134 struct vms_idd
136 unsigned char flags[2];
138 /* Max length of the key. */
139 unsigned char keylen[2];
141 /* First index block. */
142 unsigned char vbn[4];
145 /* IDD flags. */
146 #define IDD__FLAGS_ASCII 1
147 #define IDD__FLAGS_LOCKED 2
148 #define IDD__FLAGS_VARLENIDX 4
149 #define IDD__FLAGS_NOCASECMP 8
150 #define IDD__FLAGS_NOCASENTR 16
151 #define IDD__FLAGS_UPCASNTRY 32
153 #define IDD_LENGTH 8
155 /* Index block. */
156 #define INDEXDEF__LENGTH 512
157 #define INDEXDEF__BLKSIZ 500
159 struct vms_indexdef
161 /* Number of bytes used. */
162 unsigned char used[2];
164 /* VBN of the parent. */
165 unsigned char parent[4];
167 unsigned char fill_1[6];
169 /* The key field contains vms_idx/vms_elfidx structures, which are
170 simply a key (= a string) and a rfa. */
171 unsigned char keys[INDEXDEF__BLKSIZ];
174 /* An offset in a file. */
176 struct vms_rfa
178 /* Logical block number, 1 based.
179 0 means that the field is absent. Block size is 512. */
180 unsigned char vbn[4];
182 /* Offset within the block. */
183 unsigned char offset[2];
186 /* Index keys. For version 3. */
188 struct vms_idx
190 /* Offset from the start of the vbn, so minimum should be
191 DATA__DATA (ie 6). */
192 struct vms_rfa rfa;
194 unsigned char keylen;
195 /* The length of this field is in fact keylen. */
196 unsigned char keyname[256];
199 /* Index keys, for version 4 and later. */
201 struct vms_elfidx
203 struct vms_rfa rfa;
205 unsigned char keylen[2];
206 unsigned char flags;
207 unsigned char keyname[256];
210 /* Flags of elfidx. */
212 #define ELFIDX__WEAK 0x01 /* Weak symbol. */
213 #define ELFIDX__GROUP 0x02 /* Group symbol. */
214 #define ELFIDX__LISTRFA 0x04 /* RFA field points to an LHS. */
215 #define ELFIDX__SYMESC 0x08 /* Long symbol. */
217 #define RFADEF__C_INDEX 0xffff
219 /* List head structure. That's what is pointed by rfa when LISTRFA flag
220 is set in elfidx. */
222 struct vms_lhs
224 struct vms_rfa ng_g_rfa; /* Non-group global. */
225 struct vms_rfa ng_wk_rfa; /* Non-group weak. */
226 struct vms_rfa g_g_rfa; /* Group global. */
227 struct vms_rfa g_wk_rfa; /* Group weak. */
228 unsigned char flags;
231 /* List node structure. Fields of LHS point to this structure. */
233 struct vms_lns
235 /* Next node in the list. */
236 struct vms_rfa nxtrfa;
238 /* Module associated with the key. */
239 struct vms_rfa modrfa;
242 struct vms_datadef
244 /* Number of records in this block. */
245 unsigned char recs;
246 unsigned char fill_1;
248 /* Next vbn. */
249 unsigned char link[4];
251 /* Data. The first word is the record length, followed by record
252 data and a possible pad byte so that record length is always aligned. */
253 unsigned char data[506];
255 #define DATA__LENGTH 512
256 #define DATA__DATA 6
258 /* Key name block. This is used for keys longer than 128 bytes. */
260 struct vms_kbn
262 /* Length of the key chunk. */
263 unsigned char keylen[2];
265 /* RFA of the next chunk. */
266 struct vms_rfa rfa;
268 /* Followed by the key chunk. */
271 /* Module header. */
272 struct vms_mhd
274 /* Fixed part. */
275 unsigned char lbrflag;
276 unsigned char id;
277 unsigned char fill_1[2];
278 unsigned char refcnt[4];
279 unsigned char datim[8];
281 unsigned char objstat;
282 /* Ident or GSMATCH. */
283 unsigned char objidlng;
284 unsigned char objid[31];
286 unsigned char pad1[3];
287 unsigned char otherefcnt[4];
288 unsigned char modsize[4];
289 unsigned char pad2[4];
292 #define MHD__C_MHDID 0xad /* Value for id. */
293 #define MHD__C_MHDLEN 16 /* Fixed part length. */
294 #define MHD__C_USRDAT 16
296 /* Flags for objstat. */
297 #define MHD__M_SELSRC 0x1 /* Selective search. */
298 #define MHD__M_OBJTIR 0x2
299 #define MHD__M_WKSYM 0x4
301 struct vms_luh
303 unsigned char nxtluhblk[4];
304 unsigned char spare[2];
305 unsigned char data[506];
308 struct vms_luhdef
310 unsigned char rechdr[2];
311 unsigned char reclen[2];
313 #define LUH__RECHDRLEN 4
314 #define LUH__RECHDRMRK 0xabba
315 #define LUH__DATAFLDLEN 506
317 /* Entry in the history. */
319 struct vms_leh
321 unsigned char date[8];
322 unsigned char nbr_units[2];
323 unsigned char action[2]; /* 1: delete, 2: insert, 3: replaced. */
324 unsigned char idlen;
325 /* username
326 modules... */
329 #endif /* _VMS_LBR_H */