Subversion Repositories Kolibri OS

Rev

Rev 5191 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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