12159047fSniklas /* Alpha NLM (NetWare Loadable Module) support for BFD. 2*5f210c2aSfgsch Copyright 1993 Free Software Foundation, Inc. 32159047fSniklas By Ian Lance Taylor, Cygnus Support 42159047fSniklas 52159047fSniklas This file is part of BFD, the Binary File Descriptor library. 62159047fSniklas 72159047fSniklas This program is free software; you can redistribute it and/or modify 82159047fSniklas it under the terms of the GNU General Public License as published by 92159047fSniklas the Free Software Foundation; either version 2 of the License, or 102159047fSniklas (at your option) any later version. 112159047fSniklas 122159047fSniklas This program is distributed in the hope that it will be useful, 132159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of 142159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 152159047fSniklas GNU General Public License for more details. 162159047fSniklas 172159047fSniklas You should have received a copy of the GNU General Public License 182159047fSniklas along with this program; if not, write to the Free Software 192159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 202159047fSniklas 212159047fSniklas /* An Alpha NLM starts with an instance of this structure. */ 222159047fSniklas 232159047fSniklas struct nlm32_alpha_external_prefix_header 242159047fSniklas { 252159047fSniklas /* Magic number. Must be NLM32_ALPHA_MAGIC. */ 262159047fSniklas unsigned char magic[4]; 272159047fSniklas /* Format descriptor. Current value is 2. */ 282159047fSniklas unsigned char format[4]; 292159047fSniklas /* Size of prefix header. */ 302159047fSniklas unsigned char size[4]; 312159047fSniklas /* Padding. */ 322159047fSniklas unsigned char pad1[4]; 332159047fSniklas /* More fields may be added later, supposedly. */ 342159047fSniklas }; 352159047fSniklas 362159047fSniklas /* The external format of an Alpha NLM reloc. This is the same as an 372159047fSniklas Alpha ECOFF reloc. */ 382159047fSniklas 392159047fSniklas struct nlm32_alpha_external_reloc 402159047fSniklas { 412159047fSniklas unsigned char r_vaddr[8]; 422159047fSniklas unsigned char r_symndx[4]; 432159047fSniklas unsigned char r_bits[4]; 442159047fSniklas }; 452159047fSniklas 462159047fSniklas /* Constants to unpack the r_bits field of a reloc. */ 472159047fSniklas 482159047fSniklas #define RELOC_BITS0_TYPE_LITTLE 0xff 492159047fSniklas #define RELOC_BITS0_TYPE_SH_LITTLE 0 502159047fSniklas 512159047fSniklas #define RELOC_BITS1_EXTERN_LITTLE 0x01 522159047fSniklas 532159047fSniklas #define RELOC_BITS1_OFFSET_LITTLE 0x7e 542159047fSniklas #define RELOC_BITS1_OFFSET_SH_LITTLE 1 552159047fSniklas 562159047fSniklas #define RELOC_BITS1_RESERVED_LITTLE 0x80 572159047fSniklas #define RELOC_BITS1_RESERVED_SH_LITTLE 7 582159047fSniklas #define RELOC_BITS2_RESERVED_LITTLE 0xff 592159047fSniklas #define RELOC_BITS2_RESERVED_SH_LEFT_LITTLE 1 602159047fSniklas #define RELOC_BITS3_RESERVED_LITTLE 0x03 612159047fSniklas #define RELOC_BITS3_RESERVED_SH_LEFT_LITTLE 9 622159047fSniklas 632159047fSniklas #define RELOC_BITS3_SIZE_LITTLE 0xfc 642159047fSniklas #define RELOC_BITS3_SIZE_SH_LITTLE 2 652159047fSniklas 662159047fSniklas /* The external format of the fixed header. */ 672159047fSniklas 682159047fSniklas typedef struct nlm32_alpha_external_fixed_header 692159047fSniklas { 702159047fSniklas 712159047fSniklas /* The signature field identifies the file as an NLM. It must contain 722159047fSniklas the signature string, which depends upon the NLM target. */ 732159047fSniklas 742159047fSniklas unsigned char signature[24]; 752159047fSniklas 762159047fSniklas /* The version of the header. At this time, the highest version number 772159047fSniklas is 4. */ 782159047fSniklas 792159047fSniklas unsigned char version[4]; 802159047fSniklas 812159047fSniklas /* The name of the module, which must be a DOS name (1-8 characters followed 822159047fSniklas by a period and a 1-3 character extension). The first byte is the byte 832159047fSniklas length of the name and the last byte is a null terminator byte. This 842159047fSniklas field is fixed length, and any unused bytes should be null bytes. The 852159047fSniklas value is set by the OUTPUT keyword to NLMLINK. */ 862159047fSniklas 872159047fSniklas unsigned char moduleName[14]; 882159047fSniklas 892159047fSniklas /* Padding to make it come out correct. */ 902159047fSniklas 912159047fSniklas unsigned char pad1[2]; 922159047fSniklas 932159047fSniklas /* The byte offset of the code image from the start of the file. */ 942159047fSniklas 952159047fSniklas unsigned char codeImageOffset[4]; 962159047fSniklas 972159047fSniklas /* The size of the code image, in bytes. */ 982159047fSniklas 992159047fSniklas unsigned char codeImageSize[4]; 1002159047fSniklas 1012159047fSniklas /* The byte offset of the data image from the start of the file. */ 1022159047fSniklas 1032159047fSniklas unsigned char dataImageOffset[4]; 1042159047fSniklas 1052159047fSniklas /* The size of the data image, in bytes. */ 1062159047fSniklas 1072159047fSniklas unsigned char dataImageSize[4]; 1082159047fSniklas 1092159047fSniklas /* The size of the uninitialized data region that the loader is to be 1102159047fSniklas allocated at load time. Uninitialized data follows the initialized 1112159047fSniklas data in the NLM address space. */ 1122159047fSniklas 1132159047fSniklas unsigned char uninitializedDataSize[4]; 1142159047fSniklas 1152159047fSniklas /* The byte offset of the custom data from the start of the file. The 1162159047fSniklas custom data is set by the CUSTOM keyword to NLMLINK. It is possible 1172159047fSniklas for this to be EOF if there is no custom data. */ 1182159047fSniklas 1192159047fSniklas unsigned char customDataOffset[4]; 1202159047fSniklas 1212159047fSniklas /* The size of the custom data, in bytes. */ 1222159047fSniklas 1232159047fSniklas unsigned char customDataSize[4]; 1242159047fSniklas 1252159047fSniklas /* The byte offset of the module dependencies from the start of the file. 1262159047fSniklas The module dependencies are determined by the MODULE keyword in 1272159047fSniklas NLMLINK. */ 1282159047fSniklas 1292159047fSniklas unsigned char moduleDependencyOffset[4]; 1302159047fSniklas 1312159047fSniklas /* The number of module dependencies at the moduleDependencyOffset. */ 1322159047fSniklas 1332159047fSniklas unsigned char numberOfModuleDependencies[4]; 1342159047fSniklas 1352159047fSniklas /* The byte offset of the relocation fixup data from the start of the file */ 1362159047fSniklas 1372159047fSniklas unsigned char relocationFixupOffset[4]; 1382159047fSniklas 1392159047fSniklas unsigned char numberOfRelocationFixups[4]; 1402159047fSniklas 1412159047fSniklas unsigned char externalReferencesOffset[4]; 1422159047fSniklas 1432159047fSniklas unsigned char numberOfExternalReferences[4]; 1442159047fSniklas 1452159047fSniklas unsigned char publicsOffset[4]; 1462159047fSniklas 1472159047fSniklas unsigned char numberOfPublics[4]; 1482159047fSniklas 1492159047fSniklas /* The byte offset of the internal debug info from the start of the file. 1502159047fSniklas It is possible for this to be EOF if there is no debug info. */ 1512159047fSniklas 1522159047fSniklas unsigned char debugInfoOffset[4]; 1532159047fSniklas 1542159047fSniklas unsigned char numberOfDebugRecords[4]; 1552159047fSniklas 1562159047fSniklas unsigned char codeStartOffset[4]; 1572159047fSniklas 1582159047fSniklas unsigned char exitProcedureOffset[4]; 1592159047fSniklas 1602159047fSniklas unsigned char checkUnloadProcedureOffset[4]; 1612159047fSniklas 1622159047fSniklas unsigned char moduleType[4]; 1632159047fSniklas 1642159047fSniklas unsigned char flags[4]; 1652159047fSniklas 1662159047fSniklas } Nlm32_alpha_External_Fixed_Header; 167