1 /* Alpha NLM (NetWare Loadable Module) support for BFD.
2 Copyright 1993, 2005, 2010 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 3 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,
20 MA 02110-1301, USA. */
22 /* An Alpha NLM starts with an instance of this structure. */
24 struct nlm32_alpha_external_prefix_header
26 /* Magic number. Must be NLM32_ALPHA_MAGIC. */
27 unsigned char magic[4];
28 /* Format descriptor. Current value is 2. */
29 unsigned char format[4];
30 /* Size of prefix header. */
31 unsigned char size[4];
33 unsigned char pad1[4];
34 /* More fields may be added later, supposedly. */
37 /* The external format of an Alpha NLM reloc. This is the same as an
40 struct nlm32_alpha_external_reloc
42 unsigned char r_vaddr[8];
43 unsigned char r_symndx[4];
44 unsigned char r_bits[4];
47 /* Constants to unpack the r_bits field of a reloc. */
49 #define RELOC_BITS0_TYPE_LITTLE 0xff
50 #define RELOC_BITS0_TYPE_SH_LITTLE 0
52 #define RELOC_BITS1_EXTERN_LITTLE 0x01
54 #define RELOC_BITS1_OFFSET_LITTLE 0x7e
55 #define RELOC_BITS1_OFFSET_SH_LITTLE 1
57 #define RELOC_BITS1_RESERVED_LITTLE 0x80
58 #define RELOC_BITS1_RESERVED_SH_LITTLE 7
59 #define RELOC_BITS2_RESERVED_LITTLE 0xff
60 #define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1
61 #define RELOC_BITS3_RESERVED_LITTLE 0x03
62 #define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9
64 #define RELOC_BITS3_SIZE_LITTLE 0xfc
65 #define RELOC_BITS3_SIZE_SH_LITTLE 2
67 /* The external format of the fixed header. */
69 typedef struct nlm32_alpha_external_fixed_header
72 /* The signature field identifies the file as an NLM. It must contain
73 the signature string, which depends upon the NLM target. */
75 unsigned char signature[24];
77 /* The version of the header. At this time, the highest version number
80 unsigned char version[4];
82 /* The name of the module, which must be a DOS name (1-8 characters followed
83 by a period and a 1-3 character extension). The first byte is the byte
84 length of the name and the last byte is a null terminator byte. This
85 field is fixed length, and any unused bytes should be null bytes. The
86 value is set by the OUTPUT keyword to NLMLINK. */
88 unsigned char moduleName[14];
90 /* Padding to make it come out correct. */
92 unsigned char pad1[2];
94 /* The byte offset of the code image from the start of the file. */
96 unsigned char codeImageOffset[4];
98 /* The size of the code image, in bytes. */
100 unsigned char codeImageSize[4];
102 /* The byte offset of the data image from the start of the file. */
104 unsigned char dataImageOffset[4];
106 /* The size of the data image, in bytes. */
108 unsigned char dataImageSize[4];
110 /* The size of the uninitialized data region that the loader is to be
111 allocated at load time. Uninitialized data follows the initialized
112 data in the NLM address space. */
114 unsigned char uninitializedDataSize[4];
116 /* The byte offset of the custom data from the start of the file. The
117 custom data is set by the CUSTOM keyword to NLMLINK. It is possible
118 for this to be EOF if there is no custom data. */
120 unsigned char customDataOffset[4];
122 /* The size of the custom data, in bytes. */
124 unsigned char customDataSize[4];
126 /* The byte offset of the module dependencies from the start of the file.
127 The module dependencies are determined by the MODULE keyword in
130 unsigned char moduleDependencyOffset[4];
132 /* The number of module dependencies at the moduleDependencyOffset. */
134 unsigned char numberOfModuleDependencies[4];
136 /* The byte offset of the relocation fixup data from the start of the file */
138 unsigned char relocationFixupOffset[4];
140 unsigned char numberOfRelocationFixups[4];
142 unsigned char externalReferencesOffset[4];
144 unsigned char numberOfExternalReferences[4];
146 unsigned char publicsOffset[4];
148 unsigned char numberOfPublics[4];
150 /* The byte offset of the internal debug info from the start of the file.
151 It is possible for this to be EOF if there is no debug info. */
153 unsigned char debugInfoOffset[4];
155 unsigned char numberOfDebugRecords[4];
157 unsigned char codeStartOffset[4];
159 unsigned char exitProcedureOffset[4];
161 unsigned char checkUnloadProcedureOffset[4];
163 unsigned char moduleType[4];
165 unsigned char flags[4];
167 } Nlm32_alpha_External_Fixed_Header;