xref: /openbsd-src/gnu/usr.bin/binutils/include/nlm/ppc-ext.h (revision 2159047f7a97bd07d66507696a8b038f6aef0509)
1*2159047fSniklas /* PowerPC NLM (NetWare Loadable Module) support for BFD.
2*2159047fSniklas    Copyright (C) 1994 Free Software Foundation, Inc.
3*2159047fSniklas 
4*2159047fSniklas This file is part of BFD, the Binary File Descriptor library.
5*2159047fSniklas 
6*2159047fSniklas This program is free software; you can redistribute it and/or modify
7*2159047fSniklas it under the terms of the GNU General Public License as published by
8*2159047fSniklas the Free Software Foundation; either version 2 of the License, or
9*2159047fSniklas (at your option) any later version.
10*2159047fSniklas 
11*2159047fSniklas This program is distributed in the hope that it will be useful,
12*2159047fSniklas but WITHOUT ANY WARRANTY; without even the implied warranty of
13*2159047fSniklas MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*2159047fSniklas GNU General Public License for more details.
15*2159047fSniklas 
16*2159047fSniklas You should have received a copy of the GNU General Public License
17*2159047fSniklas along with this program; if not, write to the Free Software
18*2159047fSniklas Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19*2159047fSniklas 
20*2159047fSniklas #ifdef OLDFORMAT
21*2159047fSniklas 
22*2159047fSniklas /* The format of a PowerPC NLM changed.  These structures are only
23*2159047fSniklas    used in the old format.  */
24*2159047fSniklas 
25*2159047fSniklas /* A PowerPC NLM starts with an instance of this structure.  */
26*2159047fSniklas 
27*2159047fSniklas struct nlm32_powerpc_external_prefix_header
28*2159047fSniklas {
29*2159047fSniklas   /* Signature.  Must be "AppleNLM".  */
30*2159047fSniklas   char signature[8];
31*2159047fSniklas   /* Version number.  Current value is 1.  */
32*2159047fSniklas   unsigned char headerVersion[4];
33*2159047fSniklas   /* ??.  Should be set to 0.  */
34*2159047fSniklas   unsigned char origins[4];
35*2159047fSniklas   /* File creation date in standard Unix time format (seconds since
36*2159047fSniklas      1/1/70).  */
37*2159047fSniklas   unsigned char date[4];
38*2159047fSniklas };
39*2159047fSniklas 
40*2159047fSniklas #define NLM32_POWERPC_SIGNATURE "AppleNLM"
41*2159047fSniklas #define NLM32_POWERPC_HEADER_VERSION 1
42*2159047fSniklas 
43*2159047fSniklas /* The external format of a PowerPC NLM reloc.  This is the same as an
44*2159047fSniklas    XCOFF dynamic reloc.  */
45*2159047fSniklas 
46*2159047fSniklas struct nlm32_powerpc_external_reloc
47*2159047fSniklas {
48*2159047fSniklas   /* Address.  */
49*2159047fSniklas   unsigned char l_vaddr[4];
50*2159047fSniklas   /* Symbol table index.  This is 0 for .text and 1 for .data.  2
51*2159047fSniklas      means .bss, but I don't know if it is used.  In XCOFF, larger
52*2159047fSniklas      numbers are indices into the dynamic symbol table, but they are
53*2159047fSniklas      presumably not used in an NLM.  */
54*2159047fSniklas   unsigned char l_symndx[4];
55*2159047fSniklas   /* Relocation type.  */
56*2159047fSniklas   unsigned char l_rtype[2];
57*2159047fSniklas   /* Section number being relocated.  */
58*2159047fSniklas   unsigned char l_rsecnm[2];
59*2159047fSniklas };
60*2159047fSniklas 
61*2159047fSniklas #endif /* OLDFORMAT */
62*2159047fSniklas 
63*2159047fSniklas /* The external format of the fixed header.  */
64*2159047fSniklas 
65*2159047fSniklas typedef struct nlm32_powerpc_external_fixed_header
66*2159047fSniklas {
67*2159047fSniklas 
68*2159047fSniklas   /* The signature field identifies the file as an NLM.  It must contain
69*2159047fSniklas      the signature string, which depends upon the NLM target. */
70*2159047fSniklas 
71*2159047fSniklas   unsigned char signature[24];
72*2159047fSniklas 
73*2159047fSniklas   /* The version of the header.  At this time, the highest version number
74*2159047fSniklas      is 4. */
75*2159047fSniklas 
76*2159047fSniklas   unsigned char version[4];
77*2159047fSniklas 
78*2159047fSniklas   /* The name of the module, which must be a DOS name (1-8 characters followed
79*2159047fSniklas      by a period and a 1-3 character extension).  The first byte is the byte
80*2159047fSniklas      length of the name and the last byte is a null terminator byte.  This
81*2159047fSniklas      field is fixed length, and any unused bytes should be null bytes.  The
82*2159047fSniklas      value is set by the OUTPUT keyword to NLMLINK. */
83*2159047fSniklas 
84*2159047fSniklas   unsigned char moduleName[14];
85*2159047fSniklas 
86*2159047fSniklas   /* Padding to make it come out correct. */
87*2159047fSniklas 
88*2159047fSniklas   unsigned char pad1[2];
89*2159047fSniklas 
90*2159047fSniklas   /* The byte offset of the code image from the start of the file. */
91*2159047fSniklas 
92*2159047fSniklas   unsigned char codeImageOffset[4];
93*2159047fSniklas 
94*2159047fSniklas   /* The size of the code image, in bytes. */
95*2159047fSniklas 
96*2159047fSniklas   unsigned char codeImageSize[4];
97*2159047fSniklas 
98*2159047fSniklas   /* The byte offset of the data image from the start of the file. */
99*2159047fSniklas 
100*2159047fSniklas   unsigned char dataImageOffset[4];
101*2159047fSniklas 
102*2159047fSniklas   /* The size of the data image, in bytes. */
103*2159047fSniklas 
104*2159047fSniklas   unsigned char dataImageSize[4];
105*2159047fSniklas 
106*2159047fSniklas   /* The size of the uninitialized data region that the loader is to be
107*2159047fSniklas      allocated at load time.  Uninitialized data follows the initialized
108*2159047fSniklas      data in the NLM address space. */
109*2159047fSniklas 
110*2159047fSniklas   unsigned char uninitializedDataSize[4];
111*2159047fSniklas 
112*2159047fSniklas   /* The byte offset of the custom data from the start of the file.  The
113*2159047fSniklas      custom data is set by the CUSTOM keyword to NLMLINK.  It is possible
114*2159047fSniklas      for this to be EOF if there is no custom data. */
115*2159047fSniklas 
116*2159047fSniklas   unsigned char customDataOffset[4];
117*2159047fSniklas 
118*2159047fSniklas   /* The size of the custom data, in bytes. */
119*2159047fSniklas 
120*2159047fSniklas   unsigned char customDataSize[4];
121*2159047fSniklas 
122*2159047fSniklas   /* The byte offset of the module dependencies from the start of the file.
123*2159047fSniklas      The module dependencies are determined by the MODULE keyword in
124*2159047fSniklas      NLMLINK. */
125*2159047fSniklas 
126*2159047fSniklas   unsigned char moduleDependencyOffset[4];
127*2159047fSniklas 
128*2159047fSniklas   /* The number of module dependencies at the moduleDependencyOffset. */
129*2159047fSniklas 
130*2159047fSniklas   unsigned char numberOfModuleDependencies[4];
131*2159047fSniklas 
132*2159047fSniklas   /* The byte offset of the relocation fixup data from the start of the file */
133*2159047fSniklas 
134*2159047fSniklas   unsigned char relocationFixupOffset[4];
135*2159047fSniklas 
136*2159047fSniklas   unsigned char numberOfRelocationFixups[4];
137*2159047fSniklas 
138*2159047fSniklas   unsigned char externalReferencesOffset[4];
139*2159047fSniklas 
140*2159047fSniklas   unsigned char numberOfExternalReferences[4];
141*2159047fSniklas 
142*2159047fSniklas   unsigned char publicsOffset[4];
143*2159047fSniklas 
144*2159047fSniklas   unsigned char numberOfPublics[4];
145*2159047fSniklas 
146*2159047fSniklas   /* The byte offset of the internal debug info from the start of the file.
147*2159047fSniklas      It is possible for this to be EOF if there is no debug info. */
148*2159047fSniklas 
149*2159047fSniklas   unsigned char debugInfoOffset[4];
150*2159047fSniklas 
151*2159047fSniklas   unsigned char numberOfDebugRecords[4];
152*2159047fSniklas 
153*2159047fSniklas   unsigned char codeStartOffset[4];
154*2159047fSniklas 
155*2159047fSniklas   unsigned char exitProcedureOffset[4];
156*2159047fSniklas 
157*2159047fSniklas   unsigned char checkUnloadProcedureOffset[4];
158*2159047fSniklas 
159*2159047fSniklas   unsigned char moduleType[4];
160*2159047fSniklas 
161*2159047fSniklas   unsigned char flags[4];
162*2159047fSniklas 
163*2159047fSniklas } Nlm32_powerpc_External_Fixed_Header;
164