1 /* Alpha NLM (NetWare Loadable Module) support for BFD.
2 Copyright 1993 Free Software Foundation, Inc.
3 By Ian Lance Taylor, Cygnus Support
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* An Alpha NLM starts with an instance of this structure. */
23 struct nlm32_alpha_external_prefix_header
25 /* Magic number. Must be NLM32_ALPHA_MAGIC. */
26 unsigned char magic
[4];
27 /* Format descriptor. Current value is 2. */
28 unsigned char format
[4];
29 /* Size of prefix header. */
30 unsigned char size
[4];
32 unsigned char pad1
[4];
33 /* More fields may be added later, supposedly. */
36 /* The external format of an Alpha NLM reloc. This is the same as an
39 struct nlm32_alpha_external_reloc
41 unsigned char r_vaddr
[8];
42 unsigned char r_symndx
[4];
43 unsigned char r_bits
[4];
46 /* Constants to unpack the r_bits field of a reloc. */
48 #define RELOC_BITS0_TYPE_LITTLE 0xff
49 #define RELOC_BITS0_TYPE_SH_LITTLE 0
51 #define RELOC_BITS1_EXTERN_LITTLE 0x01
53 #define RELOC_BITS1_OFFSET_LITTLE 0x7e
54 #define RELOC_BITS1_OFFSET_SH_LITTLE 1
56 #define RELOC_BITS1_RESERVED_LITTLE 0x80
57 #define RELOC_BITS1_RESERVED_SH_LITTLE 7
58 #define RELOC_BITS2_RESERVED_LITTLE 0xff
59 #define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1
60 #define RELOC_BITS3_RESERVED_LITTLE 0x03
61 #define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9
63 #define RELOC_BITS3_SIZE_LITTLE 0xfc
64 #define RELOC_BITS3_SIZE_SH_LITTLE 2
66 /* The external format of the fixed header. */
68 typedef struct nlm32_alpha_external_fixed_header
71 /* The signature field identifies the file as an NLM. It must contain
72 the signature string, which depends upon the NLM target. */
74 unsigned char signature
[24];
76 /* The version of the header. At this time, the highest version number
79 unsigned char version
[4];
81 /* The name of the module, which must be a DOS name (1-8 characters followed
82 by a period and a 1-3 character extension). The first byte is the byte
83 length of the name and the last byte is a null terminator byte. This
84 field is fixed length, and any unused bytes should be null bytes. The
85 value is set by the OUTPUT keyword to NLMLINK. */
87 unsigned char moduleName
[14];
89 /* Padding to make it come out correct. */
91 unsigned char pad1
[2];
93 /* The byte offset of the code image from the start of the file. */
95 unsigned char codeImageOffset
[4];
97 /* The size of the code image, in bytes. */
99 unsigned char codeImageSize
[4];
101 /* The byte offset of the data image from the start of the file. */
103 unsigned char dataImageOffset
[4];
105 /* The size of the data image, in bytes. */
107 unsigned char dataImageSize
[4];
109 /* The size of the uninitialized data region that the loader is to be
110 allocated at load time. Uninitialized data follows the initialized
111 data in the NLM address space. */
113 unsigned char uninitializedDataSize
[4];
115 /* The byte offset of the custom data from the start of the file. The
116 custom data is set by the CUSTOM keyword to NLMLINK. It is possible
117 for this to be EOF if there is no custom data. */
119 unsigned char customDataOffset
[4];
121 /* The size of the custom data, in bytes. */
123 unsigned char customDataSize
[4];
125 /* The byte offset of the module dependencies from the start of the file.
126 The module dependencies are determined by the MODULE keyword in
129 unsigned char moduleDependencyOffset
[4];
131 /* The number of module dependencies at the moduleDependencyOffset. */
133 unsigned char numberOfModuleDependencies
[4];
135 /* The byte offset of the relocation fixup data from the start of the file */
137 unsigned char relocationFixupOffset
[4];
139 unsigned char numberOfRelocationFixups
[4];
141 unsigned char externalReferencesOffset
[4];
143 unsigned char numberOfExternalReferences
[4];
145 unsigned char publicsOffset
[4];
147 unsigned char numberOfPublics
[4];
149 /* The byte offset of the internal debug info from the start of the file.
150 It is possible for this to be EOF if there is no debug info. */
152 unsigned char debugInfoOffset
[4];
154 unsigned char numberOfDebugRecords
[4];
156 unsigned char codeStartOffset
[4];
158 unsigned char exitProcedureOffset
[4];
160 unsigned char checkUnloadProcedureOffset
[4];
162 unsigned char moduleType
[4];
164 unsigned char flags
[4];
166 } Nlm32_alpha_External_Fixed_Header
;