Update my e-mail address.
[binutils-gdb.git] / include / vms / lbr.h
blob4bb1457eb1c723a616913ac0645a313ff54568fc
1 /* Alpha VMS external format of Libraries.
3 Copyright (C) 2010-2017 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 /* Number of free blocks. */
91 unsigned char freidxblk[4];
92 /* VBN of a simply linked list of free blocks. The list is terminated by a
93 nul VBN. */
94 unsigned char freeidx[4];
96 /* Highest pre-allocated index block and in use. */
97 unsigned char hipreal[4];
98 unsigned char hiprusd[4];
100 /* Number of index blocks in use. */
101 unsigned char idxblks[4];
103 /* Number of index entries. */
104 unsigned char idxcnt[4];
106 /* Number of modules entries. */
107 unsigned char modcnt[4];
109 unsigned char fill_3[2];
111 /* Number of module headers. */
112 unsigned char modhdrs[4];
114 /* Overhead index pointers. */
115 unsigned char idxovh[4];
117 /* Update history records. */
118 unsigned char maxluhrec[2];
119 unsigned char numluhrec[2];
120 unsigned char begluhrfa[6];
121 unsigned char endluhrfa[6];
123 /* DCX map. */
124 unsigned char dcxmapvbn[4];
126 unsigned char fill_4[4 * 13];
129 /* Known major ids. */
130 #define LBR_MAJORID 3 /* Alpha libraries. */
131 #define LBR_ELFMAJORID 6 /* Elf libraries (new index, new data). */
133 /* Offset of the first IDD. */
134 #define LHD_IDXDESC 196
136 /* InDex Description. */
137 struct vms_idd
139 unsigned char flags[2];
141 /* Max length of the key. */
142 unsigned char keylen[2];
144 /* First index block. */
145 unsigned char vbn[4];
148 /* IDD flags. */
149 #define IDD__FLAGS_ASCII 1
150 #define IDD__FLAGS_LOCKED 2
151 #define IDD__FLAGS_VARLENIDX 4
152 #define IDD__FLAGS_NOCASECMP 8
153 #define IDD__FLAGS_NOCASENTR 16
154 #define IDD__FLAGS_UPCASNTRY 32
156 #define IDD_LENGTH 8
158 /* Index block. */
159 #define INDEXDEF__LENGTH 512
160 #define INDEXDEF__BLKSIZ 500
162 struct vms_indexdef
164 /* Number of bytes used. */
165 unsigned char used[2];
167 /* VBN of the parent. */
168 unsigned char parent[4];
170 unsigned char fill_1[6];
172 /* The key field contains vms_idx/vms_elfidx structures, which are
173 simply a key (= a string) and a rfa. */
174 unsigned char keys[INDEXDEF__BLKSIZ];
177 /* An offset in a file. */
179 struct vms_rfa
181 /* Logical block number, 1 based.
182 0 means that the field is absent. Block size is 512. */
183 unsigned char vbn[4];
185 /* Offset within the block. */
186 unsigned char offset[2];
189 /* Index keys. For version 3. */
191 struct vms_idx
193 /* Offset from the start of the vbn, so minimum should be
194 DATA__DATA (ie 6). */
195 struct vms_rfa rfa;
197 unsigned char keylen;
198 /* The length of this field is in fact keylen. */
199 unsigned char keyname[256];
202 /* Index keys, for version 4 and later. */
204 struct vms_elfidx
206 struct vms_rfa rfa;
208 unsigned char keylen[2];
209 unsigned char flags;
210 unsigned char keyname[256];
213 /* Flags of elfidx. */
215 #define ELFIDX__WEAK 0x01 /* Weak symbol. */
216 #define ELFIDX__GROUP 0x02 /* Group symbol. */
217 #define ELFIDX__LISTRFA 0x04 /* RFA field points to an LHS. */
218 #define ELFIDX__SYMESC 0x08 /* Long symbol. */
220 #define RFADEF__C_INDEX 0xffff
222 /* List head structure. That's what is pointed by rfa when LISTRFA flag
223 is set in elfidx. */
225 struct vms_lhs
227 struct vms_rfa ng_g_rfa; /* Non-group global. */
228 struct vms_rfa ng_wk_rfa; /* Non-group weak. */
229 struct vms_rfa g_g_rfa; /* Group global. */
230 struct vms_rfa g_wk_rfa; /* Group weak. */
231 unsigned char flags;
234 /* List node structure. Fields of LHS point to this structure. */
236 struct vms_lns
238 /* Next node in the list. */
239 struct vms_rfa nxtrfa;
241 /* Module associated with the key. */
242 struct vms_rfa modrfa;
245 struct vms_datadef
247 /* Number of records in this block. */
248 unsigned char recs;
249 unsigned char fill_1;
251 /* Next vbn. */
252 unsigned char link[4];
254 /* Data. The first word is the record length, followed by record
255 data and a possible pad byte so that record length is always aligned. */
256 unsigned char data[506];
258 #define DATA__LENGTH 512
259 #define DATA__DATA 6
261 /* Key name block. This is used for keys longer than 128 bytes. */
263 struct vms_kbn
265 /* Length of the key chunk. */
266 unsigned char keylen[2];
268 /* RFA of the next chunk. */
269 struct vms_rfa rfa;
271 /* Followed by the key chunk. */
274 /* Module header. */
275 struct vms_mhd
277 /* Fixed part. */
278 unsigned char lbrflag;
279 unsigned char id;
280 unsigned char fill_1[2];
281 unsigned char refcnt[4];
282 unsigned char datim[8];
284 unsigned char objstat;
285 /* Ident or GSMATCH. */
286 unsigned char objidlng;
287 unsigned char objid[31];
289 unsigned char pad1[3];
290 unsigned char otherefcnt[4];
291 unsigned char modsize[4];
292 unsigned char pad2[4];
295 #define MHD__C_MHDID 0xad /* Value for id. */
296 #define MHD__C_MHDLEN 16 /* Fixed part length. */
297 #define MHD__C_USRDAT 16
299 /* Flags for objstat. */
300 #define MHD__M_SELSRC 0x1 /* Selective search. */
301 #define MHD__M_OBJTIR 0x2
302 #define MHD__M_WKSYM 0x4
304 struct vms_luh
306 unsigned char nxtluhblk[4];
307 unsigned char spare[2];
308 unsigned char data[506];
311 struct vms_luhdef
313 unsigned char rechdr[2];
314 unsigned char reclen[2];
316 #define LUH__RECHDRLEN 4
317 #define LUH__RECHDRMRK 0xabba
318 #define LUH__DATAFLDLEN 506
320 /* Entry in the history. */
322 struct vms_leh
324 unsigned char date[8];
325 unsigned char nbr_units[2];
326 unsigned char action[2]; /* 1: delete, 2: insert, 3: replaced. */
327 unsigned char idlen;
328 /* username
329 modules... */
332 #endif /* _VMS_LBR_H */