1 |
24 |
jeremybenn |
/* Alpha NLM (NetWare Loadable Module) support for BFD.
|
2 |
|
|
Copyright 1993 Free Software Foundation, Inc.
|
3 |
|
|
By Ian Lance Taylor, Cygnus Support
|
4 |
|
|
|
5 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
6 |
|
|
|
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.
|
11 |
|
|
|
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.
|
16 |
|
|
|
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. */
|
20 |
|
|
|
21 |
|
|
/* An Alpha NLM starts with an instance of this structure. */
|
22 |
|
|
|
23 |
|
|
struct nlm32_alpha_external_prefix_header
|
24 |
|
|
{
|
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];
|
31 |
|
|
/* Padding. */
|
32 |
|
|
unsigned char pad1[4];
|
33 |
|
|
/* More fields may be added later, supposedly. */
|
34 |
|
|
};
|
35 |
|
|
|
36 |
|
|
/* The external format of an Alpha NLM reloc. This is the same as an
|
37 |
|
|
Alpha ECOFF reloc. */
|
38 |
|
|
|
39 |
|
|
struct nlm32_alpha_external_reloc
|
40 |
|
|
{
|
41 |
|
|
unsigned char r_vaddr[8];
|
42 |
|
|
unsigned char r_symndx[4];
|
43 |
|
|
unsigned char r_bits[4];
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
/* Constants to unpack the r_bits field of a reloc. */
|
47 |
|
|
|
48 |
|
|
#define RELOC_BITS0_TYPE_LITTLE 0xff
|
49 |
|
|
#define RELOC_BITS0_TYPE_SH_LITTLE 0
|
50 |
|
|
|
51 |
|
|
#define RELOC_BITS1_EXTERN_LITTLE 0x01
|
52 |
|
|
|
53 |
|
|
#define RELOC_BITS1_OFFSET_LITTLE 0x7e
|
54 |
|
|
#define RELOC_BITS1_OFFSET_SH_LITTLE 1
|
55 |
|
|
|
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
|
62 |
|
|
|
63 |
|
|
#define RELOC_BITS3_SIZE_LITTLE 0xfc
|
64 |
|
|
#define RELOC_BITS3_SIZE_SH_LITTLE 2
|
65 |
|
|
|
66 |
|
|
/* The external format of the fixed header. */
|
67 |
|
|
|
68 |
|
|
typedef struct nlm32_alpha_external_fixed_header
|
69 |
|
|
{
|
70 |
|
|
|
71 |
|
|
/* The signature field identifies the file as an NLM. It must contain
|
72 |
|
|
the signature string, which depends upon the NLM target. */
|
73 |
|
|
|
74 |
|
|
unsigned char signature[24];
|
75 |
|
|
|
76 |
|
|
/* The version of the header. At this time, the highest version number
|
77 |
|
|
is 4. */
|
78 |
|
|
|
79 |
|
|
unsigned char version[4];
|
80 |
|
|
|
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. */
|
86 |
|
|
|
87 |
|
|
unsigned char moduleName[14];
|
88 |
|
|
|
89 |
|
|
/* Padding to make it come out correct. */
|
90 |
|
|
|
91 |
|
|
unsigned char pad1[2];
|
92 |
|
|
|
93 |
|
|
/* The byte offset of the code image from the start of the file. */
|
94 |
|
|
|
95 |
|
|
unsigned char codeImageOffset[4];
|
96 |
|
|
|
97 |
|
|
/* The size of the code image, in bytes. */
|
98 |
|
|
|
99 |
|
|
unsigned char codeImageSize[4];
|
100 |
|
|
|
101 |
|
|
/* The byte offset of the data image from the start of the file. */
|
102 |
|
|
|
103 |
|
|
unsigned char dataImageOffset[4];
|
104 |
|
|
|
105 |
|
|
/* The size of the data image, in bytes. */
|
106 |
|
|
|
107 |
|
|
unsigned char dataImageSize[4];
|
108 |
|
|
|
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. */
|
112 |
|
|
|
113 |
|
|
unsigned char uninitializedDataSize[4];
|
114 |
|
|
|
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. */
|
118 |
|
|
|
119 |
|
|
unsigned char customDataOffset[4];
|
120 |
|
|
|
121 |
|
|
/* The size of the custom data, in bytes. */
|
122 |
|
|
|
123 |
|
|
unsigned char customDataSize[4];
|
124 |
|
|
|
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
|
127 |
|
|
NLMLINK. */
|
128 |
|
|
|
129 |
|
|
unsigned char moduleDependencyOffset[4];
|
130 |
|
|
|
131 |
|
|
/* The number of module dependencies at the moduleDependencyOffset. */
|
132 |
|
|
|
133 |
|
|
unsigned char numberOfModuleDependencies[4];
|
134 |
|
|
|
135 |
|
|
/* The byte offset of the relocation fixup data from the start of the file */
|
136 |
|
|
|
137 |
|
|
unsigned char relocationFixupOffset[4];
|
138 |
|
|
|
139 |
|
|
unsigned char numberOfRelocationFixups[4];
|
140 |
|
|
|
141 |
|
|
unsigned char externalReferencesOffset[4];
|
142 |
|
|
|
143 |
|
|
unsigned char numberOfExternalReferences[4];
|
144 |
|
|
|
145 |
|
|
unsigned char publicsOffset[4];
|
146 |
|
|
|
147 |
|
|
unsigned char numberOfPublics[4];
|
148 |
|
|
|
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. */
|
151 |
|
|
|
152 |
|
|
unsigned char debugInfoOffset[4];
|
153 |
|
|
|
154 |
|
|
unsigned char numberOfDebugRecords[4];
|
155 |
|
|
|
156 |
|
|
unsigned char codeStartOffset[4];
|
157 |
|
|
|
158 |
|
|
unsigned char exitProcedureOffset[4];
|
159 |
|
|
|
160 |
|
|
unsigned char checkUnloadProcedureOffset[4];
|
161 |
|
|
|
162 |
|
|
unsigned char moduleType[4];
|
163 |
|
|
|
164 |
|
|
unsigned char flags[4];
|
165 |
|
|
|
166 |
|
|
} Nlm32_alpha_External_Fixed_Header;
|