12159047fSniklas /* NLM (NetWare Loadable Module) support for BFD. 2*5f210c2aSfgsch Copyright 1993, 1994 Free Software Foundation, Inc. 32159047fSniklas 42159047fSniklas Written by Fred Fish @ Cygnus Support 52159047fSniklas 62159047fSniklas This file is part of BFD, the Binary File Descriptor library. 72159047fSniklas 82159047fSniklas This program is free software; you can redistribute it and/or modify 92159047fSniklas it under the terms of the GNU General Public License as published by 102159047fSniklas the Free Software Foundation; either version 2 of the License, or 112159047fSniklas (at your option) any later version. 122159047fSniklas 132159047fSniklas This program is distributed in the hope that it will be useful, 142159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of 152159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 162159047fSniklas GNU General Public License for more details. 172159047fSniklas 182159047fSniklas You should have received a copy of the GNU General Public License 192159047fSniklas along with this program; if not, write to the Free Software 202159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 212159047fSniklas 222159047fSniklas 232159047fSniklas /* This file is part of NLM support for BFD, and contains the portions 242159047fSniklas that describe how NLM is represented externally by the BFD library. 252159047fSniklas I.E. it describes the in-file representation of NLM. It requires 262159047fSniklas the nlm/common.h file which contains the portions that are common to 272159047fSniklas both the internal and external representations. 282159047fSniklas 292159047fSniklas Note that an NLM header consists of three parts: 302159047fSniklas 312159047fSniklas (1) A fixed length header that has specific fields of known length, 322159047fSniklas at specific offsets in the file. 332159047fSniklas 342159047fSniklas (2) A variable length header that has specific fields in a specific 352159047fSniklas order, but some fields may be variable length. 362159047fSniklas 372159047fSniklas (3) A auxiliary header that has various optional fields in no specific 382159047fSniklas order. There is no way to identify the end of the auxiliary headers 392159047fSniklas except by finding a header without a recognized 'stamp'. 402159047fSniklas 412159047fSniklas The exact format of the fixed length header unfortunately varies 422159047fSniklas from one NLM target to another, due to padding. Each target 432159047fSniklas defines the correct external format in a separate header file. 442159047fSniklas 452159047fSniklas */ 462159047fSniklas 472159047fSniklas /* NLM Header */ 482159047fSniklas 492159047fSniklas /* The version header is one of the optional auxiliary headers and 502159047fSniklas follows the fixed length and variable length NLM headers. */ 512159047fSniklas 522159047fSniklas typedef struct nlmNAME(external_version_header) 532159047fSniklas { 542159047fSniklas 552159047fSniklas /* The header is recognized by "VeRsIoN#" in the stamp field. */ 562159047fSniklas char stamp[8]; 572159047fSniklas 582159047fSniklas unsigned char majorVersion[NLM_TARGET_LONG_SIZE]; 592159047fSniklas 602159047fSniklas unsigned char minorVersion[NLM_TARGET_LONG_SIZE]; 612159047fSniklas 622159047fSniklas unsigned char revision[NLM_TARGET_LONG_SIZE]; 632159047fSniklas 642159047fSniklas unsigned char year[NLM_TARGET_LONG_SIZE]; 652159047fSniklas 662159047fSniklas unsigned char month[NLM_TARGET_LONG_SIZE]; 672159047fSniklas 682159047fSniklas unsigned char day[NLM_TARGET_LONG_SIZE]; 692159047fSniklas 702159047fSniklas } NlmNAME(External_Version_Header); 712159047fSniklas 722159047fSniklas 732159047fSniklas typedef struct nlmNAME(external_copyright_header) 742159047fSniklas { 752159047fSniklas 762159047fSniklas /* The header is recognized by "CoPyRiGhT=" in the stamp field. */ 772159047fSniklas 782159047fSniklas char stamp[10]; 792159047fSniklas 802159047fSniklas unsigned char copyrightMessageLength[1]; 812159047fSniklas 822159047fSniklas /* There is a variable length field here called 'copyrightMessage' 832159047fSniklas that is the length specified by copyrightMessageLength. */ 842159047fSniklas 852159047fSniklas } NlmNAME(External_Copyright_Header); 862159047fSniklas 872159047fSniklas 882159047fSniklas typedef struct nlmNAME(external_extended_header) 892159047fSniklas { 902159047fSniklas 912159047fSniklas /* The header is recognized by "MeSsAgEs" in the stamp field. */ 922159047fSniklas 932159047fSniklas char stamp[8]; 942159047fSniklas 952159047fSniklas unsigned char languageID[NLM_TARGET_LONG_SIZE]; 962159047fSniklas 972159047fSniklas unsigned char messageFileOffset[NLM_TARGET_LONG_SIZE]; 982159047fSniklas 992159047fSniklas unsigned char messageFileLength[NLM_TARGET_LONG_SIZE]; 1002159047fSniklas 1012159047fSniklas unsigned char messageCount[NLM_TARGET_LONG_SIZE]; 1022159047fSniklas 1032159047fSniklas unsigned char helpFileOffset[NLM_TARGET_LONG_SIZE]; 1042159047fSniklas 1052159047fSniklas unsigned char helpFileLength[NLM_TARGET_LONG_SIZE]; 1062159047fSniklas 1072159047fSniklas unsigned char RPCDataOffset[NLM_TARGET_LONG_SIZE]; 1082159047fSniklas 1092159047fSniklas unsigned char RPCDataLength[NLM_TARGET_LONG_SIZE]; 1102159047fSniklas 1112159047fSniklas unsigned char sharedCodeOffset[NLM_TARGET_LONG_SIZE]; 1122159047fSniklas 1132159047fSniklas unsigned char sharedCodeLength[NLM_TARGET_LONG_SIZE]; 1142159047fSniklas 1152159047fSniklas unsigned char sharedDataOffset[NLM_TARGET_LONG_SIZE]; 1162159047fSniklas 1172159047fSniklas unsigned char sharedDataLength[NLM_TARGET_LONG_SIZE]; 1182159047fSniklas 1192159047fSniklas unsigned char sharedRelocationFixupOffset[NLM_TARGET_LONG_SIZE]; 1202159047fSniklas 1212159047fSniklas unsigned char sharedRelocationFixupCount[NLM_TARGET_LONG_SIZE]; 1222159047fSniklas 1232159047fSniklas unsigned char sharedExternalReferenceOffset[NLM_TARGET_LONG_SIZE]; 1242159047fSniklas 1252159047fSniklas unsigned char sharedExternalReferenceCount[NLM_TARGET_LONG_SIZE]; 1262159047fSniklas 1272159047fSniklas unsigned char sharedPublicsOffset[NLM_TARGET_LONG_SIZE]; 1282159047fSniklas 1292159047fSniklas unsigned char sharedPublicsCount[NLM_TARGET_LONG_SIZE]; 1302159047fSniklas 1312159047fSniklas unsigned char sharedDebugRecordOffset[NLM_TARGET_LONG_SIZE]; 1322159047fSniklas 1332159047fSniklas unsigned char sharedDebugRecordCount[NLM_TARGET_LONG_SIZE]; 1342159047fSniklas 1352159047fSniklas unsigned char sharedInitializationOffset[NLM_TARGET_ADDRESS_SIZE]; 1362159047fSniklas 1372159047fSniklas unsigned char SharedExitProcedureOffset[NLM_TARGET_ADDRESS_SIZE]; 1382159047fSniklas 1392159047fSniklas unsigned char productID[NLM_TARGET_LONG_SIZE]; 1402159047fSniklas 1412159047fSniklas unsigned char reserved0[NLM_TARGET_LONG_SIZE]; 1422159047fSniklas 1432159047fSniklas unsigned char reserved1[NLM_TARGET_LONG_SIZE]; 1442159047fSniklas 1452159047fSniklas unsigned char reserved2[NLM_TARGET_LONG_SIZE]; 1462159047fSniklas 1472159047fSniklas unsigned char reserved3[NLM_TARGET_LONG_SIZE]; 1482159047fSniklas 1492159047fSniklas unsigned char reserved4[NLM_TARGET_LONG_SIZE]; 1502159047fSniklas 1512159047fSniklas unsigned char reserved5[NLM_TARGET_LONG_SIZE]; 1522159047fSniklas 1532159047fSniklas } NlmNAME(External_Extended_Header); 1542159047fSniklas 1552159047fSniklas 1562159047fSniklas typedef struct nlmNAME(external_custom_header) 1572159047fSniklas { 1582159047fSniklas 1592159047fSniklas /* The header is recognized by "CuStHeAd" in the stamp field. */ 1602159047fSniklas char stamp[8]; 1612159047fSniklas 1622159047fSniklas /* Length of this header. */ 1632159047fSniklas unsigned char length[NLM_TARGET_LONG_SIZE]; 1642159047fSniklas 1652159047fSniklas /* Offset to data. */ 1662159047fSniklas unsigned char dataOffset[NLM_TARGET_LONG_SIZE]; 1672159047fSniklas 1682159047fSniklas /* Length of data. */ 1692159047fSniklas unsigned char dataLength[NLM_TARGET_LONG_SIZE]; 1702159047fSniklas 1712159047fSniklas /* Stamp for this customer header--we recognize "CyGnUsEx". */ 1722159047fSniklas char dataStamp[8]; 1732159047fSniklas 1742159047fSniklas } NlmNAME(External_Custom_Header); 175