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