2010-03-31 Tristan Gingold <gingold@adacore.com>
[binutils-gdb.git] / include / vms / lbr.h
1 /* Alpha VMS external format of Libraries.
2
3 Copyright 2010 Free Software Foundation, Inc.
4 Written by Tristan Gingold <gingold@adacore.com>, AdaCore.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
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.
12
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.
17
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. */
22
23 #ifndef _VMS_LBR_H
24 #define _VMS_LBR_H
25
26 /* Libray HeaDer. */
27
28 #define LHD_SANEID_DCX 319232342
29 #define LHD_SANEID3 233579905
30 #define LHD_SANEID4 233579911
31
32 /* Library type. */
33 #define LBR__C_TYP_UNK 0 /* Unknown / unspecified. */
34 #define LBR__C_TYP_OBJ 1 /* Vax object. */
35 #define LBR__C_TYP_MLB 2 /* Macro. */
36 #define LBR__C_TYP_HLP 3 /* Help. */
37 #define LBR__C_TYP_TXT 4 /* Text. */
38 #define LBR__C_TYP_SHSTB 5 /* Vax shareable image. */
39 #define LBR__C_TYP_NCS 6 /* NCS. */
40 #define LBR__C_TYP_EOBJ 7 /* Alpha object. */
41 #define LBR__C_TYP_ESHSTB 8 /* Alpha shareable image. */
42 #define LBR__C_TYP_IOBJ 9 /* IA-64 object. */
43
44 struct vms_lhd
45 {
46 /* Type of the library. See above. */
47 unsigned char type;
48
49 /* Number of indexes. Generally 1, 2 for object libraries. */
50 unsigned char nindex;
51
52 unsigned char fill_1[2];
53
54 /* Sanity Id. */
55 unsigned char sanity[4];
56
57 /* Version. */
58 unsigned char majorid[2];
59 unsigned char minorid[2];
60
61 /* Tool name. */
62 unsigned char lbrver[32];
63
64 /* Create time. */
65 unsigned char credat[8];
66
67 /* Update time. */
68 unsigned char updtim[8];
69
70 /* Size of the MHD. */
71 unsigned char mhdusz;
72
73 unsigned char idxblkf[2]; /* Unused. */
74 unsigned char fill_2;
75 unsigned char closerror[2];
76
77 unsigned char spareword[2];
78
79 /* First free block, and number of free blocks. */
80 unsigned char freevbn[4];
81 unsigned char freeblk[4];
82
83 unsigned char nextrfa[6];
84 unsigned char nextvbn[4];
85
86 /* Free pre-allocated index block. */
87 unsigned char freidxblk[4];
88 unsigned char freeidx[4];
89
90 /* Highest pre-allocated index block and in use. */
91 unsigned char hipreal[4];
92 unsigned char hiprusd[4];
93
94 /* Number of index blocks in use. */
95 unsigned char idxblks[4];
96
97 /* Number of index entries. */
98 unsigned char idxcnt[4];
99
100 /* Number of modules entries. */
101 unsigned char modcnt[4];
102
103 unsigned char fill_3[2];
104
105 /* Number of module headers. */
106 unsigned char modhdrs[4];
107
108 /* Overhead index pointers. */
109 unsigned char idxovh[4];
110
111 /* Update history records. */
112 unsigned char maxluhrec[2];
113 unsigned char numluhrec[2];
114 unsigned char begluhrfa[6];
115 unsigned char endluhrfa[6];
116
117 /* DCX map. */
118 unsigned char dcxmapvbn[4];
119
120 unsigned char fill_4[4 * 13];
121 };
122
123 /* Offset of the first IDD. */
124 #define LHD_IDXDESC 196
125
126 /* InDex Description. */
127 struct vms_idd
128 {
129 unsigned char flags[2];
130
131 /* Max length of the key. */
132 unsigned char keylen[2];
133
134 /* First index block. */
135 unsigned char vbn[4];
136 };
137
138 /* IDD flags. */
139 #define IDD__FLAGS_ASCII 1
140 #define IDD__FLAGS_LOCKED 2
141 #define IDD__FLAGS_VARLENIDX 4
142 #define IDD__FLAGS_NOCASECMP 8
143 #define IDD__FLAGS_NOCASENTR 16
144 #define IDD__FLAGS_UPCASNTRY 32
145
146 #define IDD_LENGTH 8
147
148 /* Index block. */
149 #define INDEXDEF__LENGTH 512
150 #define INDEXDEF__BLKSIZ 500
151
152 struct vms_indexdef
153 {
154 /* Number of bytes used. */
155 unsigned char used[2];
156
157 /* VBN of the parent. */
158 unsigned char parent[4];
159
160 unsigned char fill_1[6];
161 unsigned char keys[INDEXDEF__BLKSIZ];
162 };
163
164 /* Index keys. */
165 struct vms_idxdef
166 {
167 unsigned char vbn[4];
168 unsigned char offset[2];
169
170 unsigned char keylen;
171 unsigned char keyname[256];
172 };
173
174 struct vms_idxdef2
175 {
176 unsigned char vbn[4];
177
178 /* Offset from the start of the vbn, so minimum should be
179 DATA__DATA (ie 6). */
180 unsigned char offset[2];
181
182 unsigned char keylen[2];
183 unsigned char fill_1;
184 unsigned char keyname[256];
185 };
186
187 #define RFADEF__C_INDEX 0xffff
188
189 struct vms_datadef
190 {
191 /* Number of records in this block. */
192 unsigned char recs;
193 unsigned char fill_1;
194
195 /* Next vbn. */
196 unsigned char link[4];
197
198 /* Data. The first word is the record length, followed by record
199 data and a possible pad byte so that record length is always aligned. */
200 unsigned char data[506];
201 };
202 #define DATA__LENGTH 512
203 #define DATA__DATA 6
204
205 /* Module header. */
206 struct vms_mhd
207 {
208 /* Fixed part. */
209 unsigned char lbrflag;
210 unsigned char id;
211 unsigned char fill_1[2];
212 unsigned char refcnt[4];
213 unsigned char datim[8];
214
215 unsigned char objstat;
216 /* Ident or GSMATCH. */
217 unsigned char objidlng;
218 unsigned char objid[31];
219 };
220
221 #define MHD__C_MHDID 0xad /* Value for id. */
222 #define MHD__C_USRDAT 16
223 #define MHD__M_SELSRC 0x1
224 #define MHD__M_OBJTIR 0x2
225 #define MHD__M_WKSYM 0x4
226
227 struct vms_luh
228 {
229 unsigned char nxtluhblk[4];
230 unsigned char spare[2];
231 unsigned char data[506];
232 };
233
234 struct vms_luhdef
235 {
236 unsigned char rechdr[2];
237 unsigned char reclen[2];
238 };
239 #define LUH__RECHDRLEN 4
240 #define LUH__RECHDRMRK 0xabba
241 #define LUH__DATAFLDLEN 506
242
243 /* Entry in the history. */
244
245 struct vms_leh
246 {
247 unsigned char date[8];
248 unsigned char nbr_units[2];
249 unsigned char action[2]; /* 1: delete, 2: insert, 3: replaced. */
250 unsigned char idlen;
251 /* username
252 modules... */
253 };
254
255 #endif /* _VMS_LBR_H */