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