Back to index

cell-binutils  2.17cvs20070401
ppc-ext.h
Go to the documentation of this file.
00001 /* PowerPC NLM (NetWare Loadable Module) support for BFD.
00002    Copyright (C) 1994 Free Software Foundation, Inc.
00003 
00004 This file is part of BFD, the Binary File Descriptor library.
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00019 
00020 #ifdef OLDFORMAT
00021 
00022 /* The format of a PowerPC NLM changed.  These structures are only
00023    used in the old format.  */
00024 
00025 /* A PowerPC NLM starts with an instance of this structure.  */
00026 
00027 struct nlm32_powerpc_external_prefix_header
00028 {
00029   /* Signature.  Must be "AppleNLM".  */
00030   char signature[8];
00031   /* Version number.  Current value is 1.  */
00032   unsigned char headerVersion[4];
00033   /* ??.  Should be set to 0.  */
00034   unsigned char origins[4];
00035   /* File creation date in standard Unix time format (seconds since
00036      1/1/70).  */
00037   unsigned char date[4];
00038 };
00039 
00040 #define NLM32_POWERPC_SIGNATURE "AppleNLM"
00041 #define NLM32_POWERPC_HEADER_VERSION 1
00042 
00043 /* The external format of a PowerPC NLM reloc.  This is the same as an
00044    XCOFF dynamic reloc.  */
00045 
00046 struct nlm32_powerpc_external_reloc
00047 {
00048   /* Address.  */
00049   unsigned char l_vaddr[4];
00050   /* Symbol table index.  This is 0 for .text and 1 for .data.  2
00051      means .bss, but I don't know if it is used.  In XCOFF, larger
00052      numbers are indices into the dynamic symbol table, but they are
00053      presumably not used in an NLM.  */
00054   unsigned char l_symndx[4];
00055   /* Relocation type.  */
00056   unsigned char l_rtype[2];
00057   /* Section number being relocated.  */
00058   unsigned char l_rsecnm[2];
00059 };
00060 
00061 #endif /* OLDFORMAT */
00062 
00063 /* The external format of the fixed header.  */
00064 
00065 typedef struct nlm32_powerpc_external_fixed_header
00066 {
00067 
00068   /* The signature field identifies the file as an NLM.  It must contain
00069      the signature string, which depends upon the NLM target. */
00070 
00071   unsigned char signature[24];
00072 
00073   /* The version of the header.  At this time, the highest version number
00074      is 4. */
00075 
00076   unsigned char version[4];
00077 
00078   /* The name of the module, which must be a DOS name (1-8 characters followed
00079      by a period and a 1-3 character extension).  The first byte is the byte
00080      length of the name and the last byte is a null terminator byte.  This
00081      field is fixed length, and any unused bytes should be null bytes.  The
00082      value is set by the OUTPUT keyword to NLMLINK. */
00083 
00084   unsigned char moduleName[14];
00085 
00086   /* Padding to make it come out correct. */
00087 
00088   unsigned char pad1[2];
00089 
00090   /* The byte offset of the code image from the start of the file. */
00091 
00092   unsigned char codeImageOffset[4];
00093 
00094   /* The size of the code image, in bytes. */
00095 
00096   unsigned char codeImageSize[4];
00097 
00098   /* The byte offset of the data image from the start of the file. */
00099 
00100   unsigned char dataImageOffset[4];
00101 
00102   /* The size of the data image, in bytes. */
00103 
00104   unsigned char dataImageSize[4];
00105 
00106   /* The size of the uninitialized data region that the loader is to be
00107      allocated at load time.  Uninitialized data follows the initialized
00108      data in the NLM address space. */
00109 
00110   unsigned char uninitializedDataSize[4];
00111 
00112   /* The byte offset of the custom data from the start of the file.  The
00113      custom data is set by the CUSTOM keyword to NLMLINK.  It is possible
00114      for this to be EOF if there is no custom data. */
00115 
00116   unsigned char customDataOffset[4];
00117 
00118   /* The size of the custom data, in bytes. */
00119 
00120   unsigned char customDataSize[4];
00121 
00122   /* The byte offset of the module dependencies from the start of the file.
00123      The module dependencies are determined by the MODULE keyword in
00124      NLMLINK. */
00125 
00126   unsigned char moduleDependencyOffset[4];
00127 
00128   /* The number of module dependencies at the moduleDependencyOffset. */
00129 
00130   unsigned char numberOfModuleDependencies[4];
00131 
00132   /* The byte offset of the relocation fixup data from the start of the file */
00133      
00134   unsigned char relocationFixupOffset[4];
00135 
00136   unsigned char numberOfRelocationFixups[4];
00137 
00138   unsigned char externalReferencesOffset[4];
00139 
00140   unsigned char numberOfExternalReferences[4];
00141 
00142   unsigned char publicsOffset[4];
00143 
00144   unsigned char numberOfPublics[4];
00145 
00146   /* The byte offset of the internal debug info from the start of the file.
00147      It is possible for this to be EOF if there is no debug info. */
00148 
00149   unsigned char debugInfoOffset[4];
00150 
00151   unsigned char numberOfDebugRecords[4];
00152 
00153   unsigned char codeStartOffset[4];
00154 
00155   unsigned char exitProcedureOffset[4];
00156 
00157   unsigned char checkUnloadProcedureOffset[4];
00158 
00159   unsigned char moduleType[4];
00160 
00161   unsigned char flags[4];
00162 
00163 } Nlm32_powerpc_External_Fixed_Header;