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
/* `a.out' object-file definitions, including extensions to 64-bit fields
1
/* `a.out' object-file definitions, including extensions to 64-bit fields
2
 
2
 
3
   Copyright 1999, 2000, 2001, 2003, 2009, 2010 Free Software Foundation, Inc.
3
   Copyright (C) 1999-2015 Free Software Foundation, Inc.
4
 
4
 
5
   This program is free software; you can redistribute it and/or modify
5
   This program is free software; you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3 of the License, or
7
   the Free Software Foundation; either version 3 of the License, or
8
   (at your option) any later version.
8
   (at your option) any later version.
9
   
9
   
10
   This program is distributed in the hope that it will be useful,
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
13
   GNU General Public License for more details.
14
   
14
   
15
   You should have received a copy of the GNU General Public License
15
   You should have received a copy of the GNU General Public License
16
   along with this program; if not, write to the Free Software
16
   along with this program; if not, write to the Free Software
17
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
17
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
18
   MA 02110-1301, USA.  */
18
   MA 02110-1301, USA.  */
19
 
19
 
20
#ifndef __A_OUT_64_H__
20
#ifndef __A_OUT_64_H__
21
#define __A_OUT_64_H__
21
#define __A_OUT_64_H__
22
 
22
 
23
#ifndef BYTES_IN_WORD
23
#ifndef BYTES_IN_WORD
24
#define BYTES_IN_WORD 4
24
#define BYTES_IN_WORD 4
25
#endif
25
#endif
26
 
26
 
27
/* This is the layout on disk of the 32-bit or 64-bit exec header.  */
27
/* This is the layout on disk of the 32-bit or 64-bit exec header.  */
28
 
28
 
29
#ifndef external_exec
29
#ifndef external_exec
30
struct external_exec 
30
struct external_exec 
31
{
31
{
32
  bfd_byte e_info[4];		    /* Magic number and stuff.  */
32
  bfd_byte e_info[4];		    /* Magic number and stuff.  */
33
  bfd_byte e_text[BYTES_IN_WORD];   /* Length of text section in bytes.  */
33
  bfd_byte e_text[BYTES_IN_WORD];   /* Length of text section in bytes.  */
34
  bfd_byte e_data[BYTES_IN_WORD];   /* Length of data section in bytes.  */
34
  bfd_byte e_data[BYTES_IN_WORD];   /* Length of data section in bytes.  */
35
  bfd_byte e_bss[BYTES_IN_WORD];    /* Length of bss area in bytes.  */
35
  bfd_byte e_bss[BYTES_IN_WORD];    /* Length of bss area in bytes.  */
36
  bfd_byte e_syms[BYTES_IN_WORD];   /* Length of symbol table in bytes.  */
36
  bfd_byte e_syms[BYTES_IN_WORD];   /* Length of symbol table in bytes.  */
37
  bfd_byte e_entry[BYTES_IN_WORD];  /* Start address.  */
37
  bfd_byte e_entry[BYTES_IN_WORD];  /* Start address.  */
38
  bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info.  */
38
  bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info.  */
39
  bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info.  */
39
  bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info.  */
40
};
40
};
41
 
41
 
42
#define	EXEC_BYTES_SIZE	(4 + BYTES_IN_WORD * 7)
42
#define	EXEC_BYTES_SIZE	(4 + BYTES_IN_WORD * 7)
43
 
43
 
44
/* Magic numbers for a.out files.  */
44
/* Magic numbers for a.out files.  */
45
 
45
 
46
#if ARCH_SIZE==64
46
#if ARCH_SIZE==64
47
#define OMAGIC 0x1001		/* Code indicating object file.  */
47
#define OMAGIC 0x1001		/* Code indicating object file.  */
48
#define ZMAGIC 0x1002		/* Code indicating demand-paged executable.  */
48
#define ZMAGIC 0x1002		/* Code indicating demand-paged executable.  */
49
#define NMAGIC 0x1003		/* Code indicating pure executable.  */
49
#define NMAGIC 0x1003		/* Code indicating pure executable.  */
50
 
50
 
51
/* There is no 64-bit QMAGIC as far as I know.  */
51
/* There is no 64-bit QMAGIC as far as I know.  */
52
 
52
 
53
#define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
53
#define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
54
			&& N_MAGIC(x) != NMAGIC		\
54
			&& N_MAGIC(x) != NMAGIC		\
55
  			&& N_MAGIC(x) != ZMAGIC)
55
  			&& N_MAGIC(x) != ZMAGIC)
56
#else
56
#else
57
#define OMAGIC 0407		/* Object file or impure executable.  */
57
#define OMAGIC 0407		/* Object file or impure executable.  */
58
#define NMAGIC 0410		/* Code indicating pure executable.  */
58
#define NMAGIC 0410		/* Code indicating pure executable.  */
59
#define ZMAGIC 0413		/* Code indicating demand-paged executable.  */
59
#define ZMAGIC 0413		/* Code indicating demand-paged executable.  */
60
#define BMAGIC 0415		/* Used by a b.out object.  */
60
#define BMAGIC 0415		/* Used by a b.out object.  */
61
 
61
 
62
/* This indicates a demand-paged executable with the header in the text.
62
/* This indicates a demand-paged executable with the header in the text.
63
   It is used by 386BSD (and variants) and Linux, at least.  */
63
   It is used by 386BSD (and variants) and Linux, at least.  */
64
#ifndef QMAGIC
64
#ifndef QMAGIC
65
#define QMAGIC 0314
65
#define QMAGIC 0314
66
#endif
66
#endif
67
# ifndef N_BADMAG
67
# ifndef N_BADMAG
68
#  define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
68
#  define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\
69
			&& N_MAGIC(x) != NMAGIC		\
69
			&& N_MAGIC(x) != NMAGIC		\
70
  			&& N_MAGIC(x) != ZMAGIC \
70
  			&& N_MAGIC(x) != ZMAGIC \
71
		        && N_MAGIC(x) != QMAGIC)
71
		        && N_MAGIC(x) != QMAGIC)
72
# endif /* N_BADMAG */
72
# endif /* N_BADMAG */
73
#endif
73
#endif
74
 
74
 
75
#endif
75
#endif
76
 
76
 
77
#ifdef QMAGIC
77
#ifdef QMAGIC
78
#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC)
78
#define N_IS_QMAGIC(x) (N_MAGIC (x) == QMAGIC)
79
#else
79
#else
80
#define N_IS_QMAGIC(x) (0)
80
#define N_IS_QMAGIC(x) (0)
81
#endif
81
#endif
82
 
82
 
83
/* The difference between TARGET_PAGE_SIZE and N_SEGSIZE is that TARGET_PAGE_SIZE is
83
/* The difference between TARGET_PAGE_SIZE and N_SEGSIZE is that TARGET_PAGE_SIZE is
84
   the finest granularity at which you can page something, thus it
84
   the finest granularity at which you can page something, thus it
85
   controls the padding (if any) before the text segment of a ZMAGIC
85
   controls the padding (if any) before the text segment of a ZMAGIC
86
   file.  N_SEGSIZE is the resolution at which things can be marked as
86
   file.  N_SEGSIZE is the resolution at which things can be marked as
87
   read-only versus read/write, so it controls the padding between the
87
   read-only versus read/write, so it controls the padding between the
88
   text segment and the data segment (in memory; on disk the padding
88
   text segment and the data segment (in memory; on disk the padding
89
   between them is TARGET_PAGE_SIZE).  TARGET_PAGE_SIZE and N_SEGSIZE are the same
89
   between them is TARGET_PAGE_SIZE).  TARGET_PAGE_SIZE and N_SEGSIZE are the same
90
   for most machines, but different for sun3.  */
90
   for most machines, but different for sun3.  */
91
 
91
 
92
/* By default, segment size is constant.  But some machines override this
92
/* By default, segment size is constant.  But some machines override this
93
   to be a function of the a.out header (e.g. machine type).  */
93
   to be a function of the a.out header (e.g. machine type).  */
94
 
94
 
95
#ifndef	N_SEGSIZE
95
#ifndef	N_SEGSIZE
96
#define	N_SEGSIZE(x)	SEGMENT_SIZE
96
#define	N_SEGSIZE(x)	SEGMENT_SIZE
97
#endif
97
#endif
98

98

99
/* Virtual memory address of the text section.
99
/* Virtual memory address of the text section.
100
   This is getting very complicated.  A good reason to discard a.out format
100
   This is getting very complicated.  A good reason to discard a.out format
101
   for something that specifies these fields explicitly.  But til then...
101
   for something that specifies these fields explicitly.  But til then...
102
 
102
 
103
   * OMAGIC and NMAGIC files:
103
   * OMAGIC and NMAGIC files:
104
       (object files: text for "relocatable addr 0" right after the header)
104
       (object files: text for "relocatable addr 0" right after the header)
105
       start at 0, offset is EXEC_BYTES_SIZE, size as stated.
105
       start at 0, offset is EXEC_BYTES_SIZE, size as stated.
106
   * The text address, offset, and size of ZMAGIC files depend
106
   * The text address, offset, and size of ZMAGIC files depend
107
     on the entry point of the file:
107
     on the entry point of the file:
108
     * entry point below TEXT_START_ADDR:
108
     * entry point below TEXT_START_ADDR:
109
       (hack for SunOS shared libraries)
109
       (hack for SunOS shared libraries)
110
       start at 0, offset is 0, size as stated.
110
       start at 0, offset is 0, size as stated.
111
     * If N_HEADER_IN_TEXT(x) is true (which defaults to being the
111
     * If N_HEADER_IN_TEXT(x) is true (which defaults to being the
112
       case when the entry point is EXEC_BYTES_SIZE or further into a page):
112
       case when the entry point is EXEC_BYTES_SIZE or further into a page):
113
       no padding is needed; text can start after exec header.  Sun
113
       no padding is needed; text can start after exec header.  Sun
114
       considers the text segment of such files to include the exec header;
114
       considers the text segment of such files to include the exec header;
115
       for BFD's purposes, we don't, which makes more work for us.
115
       for BFD's purposes, we don't, which makes more work for us.
116
       start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,
116
       start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,
117
       size as stated minus EXEC_BYTES_SIZE.
117
       size as stated minus EXEC_BYTES_SIZE.
118
     * If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when
118
     * If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when
119
       the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page
119
       the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page
120
       aligned)): (padding is needed so that text can start at a page boundary)
120
       aligned)): (padding is needed so that text can start at a page boundary)
121
       start at TEXT_START_ADDR, offset TARGET_PAGE_SIZE, size as stated.
121
       start at TEXT_START_ADDR, offset TARGET_PAGE_SIZE, size as stated.
122
 
122
 
123
    Specific configurations may want to hardwire N_HEADER_IN_TEXT,
123
    Specific configurations may want to hardwire N_HEADER_IN_TEXT,
124
    for efficiency or to allow people to play games with the entry point.
124
    for efficiency or to allow people to play games with the entry point.
125
    In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,
125
    In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,
126
    and as 0 for most other hosts (Sony News, Vax Ultrix, etc).
126
    and as 0 for most other hosts (Sony News, Vax Ultrix, etc).
127
    (Do this in the appropriate bfd target file.)
127
    (Do this in the appropriate bfd target file.)
128
    (The default is a heuristic that will break if people try changing
128
    (The default is a heuristic that will break if people try changing
129
    the entry point, perhaps with the ld -e flag.)
129
    the entry point, perhaps with the ld -e flag.)
130
 
130
 
131
    * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
131
    * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
132
    and for which the starting address is TARGET_PAGE_SIZE (or should this be
132
    and for which the starting address is TARGET_PAGE_SIZE (or should this be
133
    SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).  */
133
    SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC).  */
134
 
134
 
135
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
135
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
136
   in the text.  */
136
   in the text.  */
137
#ifndef N_HEADER_IN_TEXT
137
#ifndef N_HEADER_IN_TEXT
138
#define N_HEADER_IN_TEXT(x) \
138
#define N_HEADER_IN_TEXT(x) \
139
  (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
139
  (((x).a_entry & (TARGET_PAGE_SIZE-1)) >= EXEC_BYTES_SIZE)
140
#endif
140
#endif
141
 
141
 
142
/* Sun shared libraries, not linux.  This macro is only relevant for ZMAGIC
142
/* Sun shared libraries, not linux.  This macro is only relevant for ZMAGIC
143
   files.  */
143
   files.  */
144
#ifndef N_SHARED_LIB
144
#ifndef N_SHARED_LIB
145
#define N_SHARED_LIB(x) (0)
145
#define N_SHARED_LIB(x) (0)
146
#endif
146
#endif
147
 
147
 
148
/* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on
148
/* Returning 0 not TEXT_START_ADDR for OMAGIC and NMAGIC is based on
149
   the assumption that we are dealing with a .o file, not an
149
   the assumption that we are dealing with a .o file, not an
150
   executable.  This is necessary for OMAGIC (but means we don't work
150
   executable.  This is necessary for OMAGIC (but means we don't work
151
   right on the output from ld -N); more questionable for NMAGIC.  */
151
   right on the output from ld -N); more questionable for NMAGIC.  */
152
 
152
 
153
#ifndef N_TXTADDR
153
#ifndef N_TXTADDR
154
#define N_TXTADDR(x) \
154
#define N_TXTADDR(x) \
155
    (/* The address of a QMAGIC file is always one page in,		\
155
    (/* The address of a QMAGIC file is always one page in,		\
156
        with the header in the text.  */				\
156
        with the header in the text.  */				\
157
     N_IS_QMAGIC (x)							\
157
     N_IS_QMAGIC (x)							\
158
     ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE			\
158
     ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE			\
159
     : (N_MAGIC (x) != ZMAGIC						\
159
     : (N_MAGIC (x) != ZMAGIC						\
160
	? (bfd_vma) 0	/* Object file or NMAGIC.  */			\
160
	? (bfd_vma) 0	/* Object file or NMAGIC.  */			\
161
	: (N_SHARED_LIB (x)						\
161
	: (N_SHARED_LIB (x)						\
162
	   ? (bfd_vma) 0						\
162
	   ? (bfd_vma) 0						\
163
	   : (N_HEADER_IN_TEXT (x)					\
163
	   : (N_HEADER_IN_TEXT (x)					\
164
	      ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE		\
164
	      ? (bfd_vma) TEXT_START_ADDR + EXEC_BYTES_SIZE		\
165
	      : (bfd_vma) TEXT_START_ADDR))))
165
	      : (bfd_vma) TEXT_START_ADDR))))
166
#endif
166
#endif
167
 
167
 
168
/* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding
168
/* If N_HEADER_IN_TEXT is not true for ZMAGIC, there is some padding
169
   to make the text segment start at a certain boundary.  For most
169
   to make the text segment start at a certain boundary.  For most
170
   systems, this boundary is TARGET_PAGE_SIZE.  But for Linux, in the
170
   systems, this boundary is TARGET_PAGE_SIZE.  But for Linux, in the
171
   time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is
171
   time-honored tradition of crazy ZMAGIC hacks, it is 1024 which is
172
   not what TARGET_PAGE_SIZE needs to be for QMAGIC.  */
172
   not what TARGET_PAGE_SIZE needs to be for QMAGIC.  */
173
 
173
 
174
#ifndef ZMAGIC_DISK_BLOCK_SIZE
174
#ifndef ZMAGIC_DISK_BLOCK_SIZE
175
#define ZMAGIC_DISK_BLOCK_SIZE TARGET_PAGE_SIZE
175
#define ZMAGIC_DISK_BLOCK_SIZE TARGET_PAGE_SIZE
176
#endif
176
#endif
177
 
177
 
178
#define N_DISK_BLOCK_SIZE(x) \
178
#define N_DISK_BLOCK_SIZE(x) \
179
  (N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : TARGET_PAGE_SIZE)
179
  (N_MAGIC(x) == ZMAGIC ? ZMAGIC_DISK_BLOCK_SIZE : TARGET_PAGE_SIZE)
180
 
180
 
181
/* Offset in an a.out of the start of the text section. */
181
/* Offset in an a.out of the start of the text section. */
182
#ifndef N_TXTOFF
182
#ifndef N_TXTOFF
183
#define N_TXTOFF(x)							\
183
#define N_TXTOFF(x)							\
184
    (/* For {O,N,Q}MAGIC, no padding.  */				\
184
    (/* For {O,N,Q}MAGIC, no padding.  */				\
185
     N_MAGIC (x) != ZMAGIC						\
185
     N_MAGIC (x) != ZMAGIC						\
186
     ? EXEC_BYTES_SIZE							\
186
     ? EXEC_BYTES_SIZE							\
187
     : (N_SHARED_LIB (x)						\
187
     : (N_SHARED_LIB (x)						\
188
	? 0								\
188
	? 0								\
189
	: (N_HEADER_IN_TEXT (x)						\
189
	: (N_HEADER_IN_TEXT (x)						\
190
	   ? EXEC_BYTES_SIZE		/* No padding.  */		\
190
	   ? EXEC_BYTES_SIZE		/* No padding.  */		\
191
	   : ZMAGIC_DISK_BLOCK_SIZE	/* A page of padding.  */)))
191
	   : ZMAGIC_DISK_BLOCK_SIZE	/* A page of padding.  */)))
192
#endif
192
#endif
193
/* Size of the text section.  It's always as stated, except that we
193
/* Size of the text section.  It's always as stated, except that we
194
   offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
194
   offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
195
   for ZMAGIC files that nominally include the exec header
195
   for ZMAGIC files that nominally include the exec header
196
   as part of the first page of text.  (BFD doesn't consider the
196
   as part of the first page of text.  (BFD doesn't consider the
197
   exec header to be part of the text segment.)  */
197
   exec header to be part of the text segment.)  */
198
#ifndef N_TXTSIZE
198
#ifndef N_TXTSIZE
199
#define	N_TXTSIZE(x) \
199
#define	N_TXTSIZE(x) \
200
  (/* For QMAGIC, we don't consider the header part of the text section.  */\
200
  (/* For QMAGIC, we don't consider the header part of the text section.  */\
201
   N_IS_QMAGIC (x)							\
201
   N_IS_QMAGIC (x)							\
202
   ? (x).a_text - EXEC_BYTES_SIZE					\
202
   ? (x).a_text - EXEC_BYTES_SIZE					\
203
   : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x))			\
203
   : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x))			\
204
      ? (x).a_text							\
204
      ? (x).a_text							\
205
      : (N_HEADER_IN_TEXT (x)						\
205
      : (N_HEADER_IN_TEXT (x)						\
206
	 ? (x).a_text - EXEC_BYTES_SIZE	/* No padding.  */		\
206
	 ? (x).a_text - EXEC_BYTES_SIZE	/* No padding.  */		\
207
	 : (x).a_text			/* A page of padding.  */ )))
207
	 : (x).a_text			/* A page of padding.  */ )))
208
#endif
208
#endif
209
/* The address of the data segment in virtual memory.
209
/* The address of the data segment in virtual memory.
210
   It is the text segment address, plus text segment size, rounded
210
   It is the text segment address, plus text segment size, rounded
211
   up to a N_SEGSIZE boundary for pure or pageable files.  */
211
   up to a N_SEGSIZE boundary for pure or pageable files.  */
212
#ifndef N_DATADDR
212
#ifndef N_DATADDR
213
#define N_DATADDR(x) \
213
#define N_DATADDR(x) \
214
  (N_MAGIC (x) == OMAGIC						\
214
  (N_MAGIC (x) == OMAGIC						\
215
   ? (N_TXTADDR (x) + N_TXTSIZE (x))					\
215
   ? (N_TXTADDR (x) + N_TXTSIZE (x))					\
216
   : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1)		\
216
   : (N_SEGSIZE (x) + ((N_TXTADDR (x) + N_TXTSIZE (x) - 1)		\
217
		       & ~ (bfd_vma) (N_SEGSIZE (x) - 1))))
217
		       & ~ (bfd_vma) (N_SEGSIZE (x) - 1))))
218
#endif
218
#endif
219
/* The address of the BSS segment -- immediately after the data segment.  */
219
/* The address of the BSS segment -- immediately after the data segment.  */
220
 
220
 
221
#define N_BSSADDR(x)	(N_DATADDR (x) + (x).a_data)
221
#define N_BSSADDR(x)	(N_DATADDR (x) + (x).a_data)
222
 
222
 
223
/* Offsets of the various portions of the file after the text segment.  */
223
/* Offsets of the various portions of the file after the text segment.  */
224
 
224
 
225
/* For {Q,Z}MAGIC, there is padding to make the data segment start on
225
/* For {Q,Z}MAGIC, there is padding to make the data segment start on
226
   a page boundary.  Most of the time the a_text field (and thus
226
   a page boundary.  Most of the time the a_text field (and thus
227
   N_TXTSIZE) already contains this padding.  It is possible that for
227
   N_TXTSIZE) already contains this padding.  It is possible that for
228
   BSDI and/or 386BSD it sometimes doesn't contain the padding, and
228
   BSDI and/or 386BSD it sometimes doesn't contain the padding, and
229
   perhaps we should be adding it here.  But this seems kind of
229
   perhaps we should be adding it here.  But this seems kind of
230
   questionable and probably should be BSDI/386BSD-specific if we do
230
   questionable and probably should be BSDI/386BSD-specific if we do
231
   do it.
231
   do it.
232
 
232
 
233
   For NMAGIC (at least for hp300 BSD, probably others), there is
233
   For NMAGIC (at least for hp300 BSD, probably others), there is
234
   padding in memory only, not on disk, so we must *not* ever pad here
234
   padding in memory only, not on disk, so we must *not* ever pad here
235
   for NMAGIC.  */
235
   for NMAGIC.  */
236
 
236
 
237
#ifndef N_DATOFF
237
#ifndef N_DATOFF
238
#define N_DATOFF(x)	(N_TXTOFF (x) + N_TXTSIZE (x))
238
#define N_DATOFF(x)	(N_TXTOFF (x) + N_TXTSIZE (x))
239
#endif
239
#endif
240
#ifndef N_TRELOFF
240
#ifndef N_TRELOFF
241
#define N_TRELOFF(x)	(N_DATOFF (x) + (x).a_data)
241
#define N_TRELOFF(x)	(N_DATOFF (x) + (x).a_data)
242
#endif
242
#endif
243
#ifndef N_DRELOFF
243
#ifndef N_DRELOFF
244
#define N_DRELOFF(x)	(N_TRELOFF (x) + (x).a_trsize)
244
#define N_DRELOFF(x)	(N_TRELOFF (x) + (x).a_trsize)
245
#endif
245
#endif
246
#ifndef N_SYMOFF
246
#ifndef N_SYMOFF
247
#define N_SYMOFF(x)	(N_DRELOFF (x) + (x).a_drsize)
247
#define N_SYMOFF(x)	(N_DRELOFF (x) + (x).a_drsize)
248
#endif
248
#endif
249
#ifndef N_STROFF
249
#ifndef N_STROFF
250
#define N_STROFF(x)	(N_SYMOFF (x) + (x).a_syms)
250
#define N_STROFF(x)	(N_SYMOFF (x) + (x).a_syms)
251
#endif
251
#endif
252

252

253
/* Symbols */
253
/* Symbols */
254
#ifndef external_nlist
254
#ifndef external_nlist
255
struct external_nlist
255
struct external_nlist
256
{
256
{
257
  bfd_byte e_strx[BYTES_IN_WORD];	/* Index into string table of name.  */
257
  bfd_byte e_strx[BYTES_IN_WORD];	/* Index into string table of name.  */
258
  bfd_byte e_type[1];			/* Type of symbol.  */
258
  bfd_byte e_type[1];			/* Type of symbol.  */
259
  bfd_byte e_other[1];			/* Misc info (usually empty).  */
259
  bfd_byte e_other[1];			/* Misc info (usually empty).  */
260
  bfd_byte e_desc[2];			/* Description field.  */
260
  bfd_byte e_desc[2];			/* Description field.  */
261
  bfd_byte e_value[BYTES_IN_WORD];	/* Value of symbol.  */
261
  bfd_byte e_value[BYTES_IN_WORD];	/* Value of symbol.  */
262
};
262
};
263
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
263
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
264
#endif
264
#endif
265
 
265
 
266
struct internal_nlist
266
struct internal_nlist
267
{
267
{
268
  unsigned long n_strx;			/* Index into string table of name.  */
268
  unsigned long n_strx;			/* Index into string table of name.  */
269
  unsigned char n_type;			/* Type of symbol.  */
269
  unsigned char n_type;			/* Type of symbol.  */
270
  unsigned char n_other;		/* Misc info (usually empty).  */
270
  unsigned char n_other;		/* Misc info (usually empty).  */
271
  unsigned short n_desc;		/* Description field.  */
271
  unsigned short n_desc;		/* Description field.  */
272
  bfd_vma n_value;			/* Value of symbol.  */
272
  bfd_vma n_value;			/* Value of symbol.  */
273
};
273
};
274
 
274
 
275
/* The n_type field is the symbol type, containing:  */
275
/* The n_type field is the symbol type, containing:  */
276
 
276
 
277
#define N_UNDF	0	/* Undefined symbol.  */
277
#define N_UNDF	0	/* Undefined symbol.  */
278
#define N_ABS 	2	/* Absolute symbol -- defined at particular addr.  */
278
#define N_ABS 	2	/* Absolute symbol -- defined at particular addr.  */
279
#define N_TEXT 	4	/* Text sym -- defined at offset in text seg.  */
279
#define N_TEXT 	4	/* Text sym -- defined at offset in text seg.  */
280
#define N_DATA 	6	/* Data sym -- defined at offset in data seg.  */
280
#define N_DATA 	6	/* Data sym -- defined at offset in data seg.  */
281
#define N_BSS 	8	/* BSS  sym -- defined at offset in zero'd seg.  */
281
#define N_BSS 	8	/* BSS  sym -- defined at offset in zero'd seg.  */
282
#define	N_COMM	0x12	/* Common symbol (visible after shared lib dynlink).  */
282
#define	N_COMM	0x12	/* Common symbol (visible after shared lib dynlink).  */
283
#define N_FN	0x1f	/* File name of .o file.  */
283
#define N_FN	0x1f	/* File name of .o file.  */
284
#define	N_FN_SEQ 0x0C	/* N_FN from Sequent compilers (sigh).  */
284
#define	N_FN_SEQ 0x0C	/* N_FN from Sequent compilers (sigh).  */
285
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
285
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
286
   N_DATA, or N_BSS.  When the low-order bit of other types is set,
286
   N_DATA, or N_BSS.  When the low-order bit of other types is set,
287
   (e.g. N_WARNING versus N_FN), they are two different types.  */
287
   (e.g. N_WARNING versus N_FN), they are two different types.  */
288
#define N_EXT 	1	/* External symbol (as opposed to local-to-this-file).  */
288
#define N_EXT 	1	/* External symbol (as opposed to local-to-this-file).  */
289
#define N_TYPE  0x1e
289
#define N_TYPE  0x1e
290
#define N_STAB 	0xe0	/* If any of these bits are on, it's a debug symbol.  */
290
#define N_STAB 	0xe0	/* If any of these bits are on, it's a debug symbol.  */
291
 
291
 
292
#define N_INDR 0x0a
292
#define N_INDR 0x0a
293
 
293
 
294
/* The following symbols refer to set elements.
294
/* The following symbols refer to set elements.
295
   All the N_SET[ATDB] symbols with the same name form one set.
295
   All the N_SET[ATDB] symbols with the same name form one set.
296
   Space is allocated for the set in the text section, and each set
296
   Space is allocated for the set in the text section, and each set
297
   elements value is stored into one word of the space.
297
   elements value is stored into one word of the space.
298
   The first word of the space is the length of the set (number of elements).
298
   The first word of the space is the length of the set (number of elements).
299
 
299
 
300
   The address of the set is made into an N_SETV symbol
300
   The address of the set is made into an N_SETV symbol
301
   whose name is the same as the name of the set.
301
   whose name is the same as the name of the set.
302
   This symbol acts like a N_DATA global symbol
302
   This symbol acts like a N_DATA global symbol
303
   in that it can satisfy undefined external references.  */
303
   in that it can satisfy undefined external references.  */
304
 
304
 
305
/* These appear as input to LD, in a .o file.  */
305
/* These appear as input to LD, in a .o file.  */
306
#define	N_SETA	0x14		/* Absolute set element symbol.  */
306
#define	N_SETA	0x14		/* Absolute set element symbol.  */
307
#define	N_SETT	0x16		/* Text set element symbol.  */
307
#define	N_SETT	0x16		/* Text set element symbol.  */
308
#define	N_SETD	0x18		/* Data set element symbol.  */
308
#define	N_SETD	0x18		/* Data set element symbol.  */
309
#define	N_SETB	0x1A		/* Bss set element symbol.  */
309
#define	N_SETB	0x1A		/* Bss set element symbol.  */
310
 
310
 
311
/* This is output from LD.  */
311
/* This is output from LD.  */
312
#define N_SETV	0x1C		/* Pointer to set vector in data area.  */
312
#define N_SETV	0x1C		/* Pointer to set vector in data area.  */
313
 
313
 
314
/* Warning symbol. The text gives a warning message, the next symbol
314
/* Warning symbol. The text gives a warning message, the next symbol
315
   in the table will be undefined. When the symbol is referenced, the
315
   in the table will be undefined. When the symbol is referenced, the
316
   message is printed.  */
316
   message is printed.  */
317
 
317
 
318
#define	N_WARNING 0x1e
318
#define	N_WARNING 0x1e
319
 
319
 
320
/* Weak symbols.  These are a GNU extension to the a.out format.  The
320
/* Weak symbols.  These are a GNU extension to the a.out format.  The
321
   semantics are those of ELF weak symbols.  Weak symbols are always
321
   semantics are those of ELF weak symbols.  Weak symbols are always
322
   externally visible.  The N_WEAK? values are squeezed into the
322
   externally visible.  The N_WEAK? values are squeezed into the
323
   available slots.  The value of a N_WEAKU symbol is 0.  The values
323
   available slots.  The value of a N_WEAKU symbol is 0.  The values
324
   of the other types are the definitions.  */
324
   of the other types are the definitions.  */
325
#define N_WEAKU	0x0d		/* Weak undefined symbol.  */
325
#define N_WEAKU	0x0d		/* Weak undefined symbol.  */
326
#define N_WEAKA 0x0e		/* Weak absolute symbol.  */
326
#define N_WEAKA 0x0e		/* Weak absolute symbol.  */
327
#define N_WEAKT 0x0f		/* Weak text symbol.  */
327
#define N_WEAKT 0x0f		/* Weak text symbol.  */
328
#define N_WEAKD 0x10		/* Weak data symbol.  */
328
#define N_WEAKD 0x10		/* Weak data symbol.  */
329
#define N_WEAKB 0x11		/* Weak bss symbol.  */
329
#define N_WEAKB 0x11		/* Weak bss symbol.  */
330
 
330
 
331
/* Relocations 
331
/* Relocations 
332
 
332
 
333
  There	are two types of relocation flavours for a.out systems,
333
  There	are two types of relocation flavours for a.out systems,
334
  standard and extended. The standard form is used on systems where the
334
  standard and extended. The standard form is used on systems where the
335
  instruction has room for all the bits of an offset to the operand, whilst
335
  instruction has room for all the bits of an offset to the operand, whilst
336
  the extended form is used when an address operand has to be split over n
336
  the extended form is used when an address operand has to be split over n
337
  instructions. Eg, on the 68k, each move instruction can reference
337
  instructions. Eg, on the 68k, each move instruction can reference
338
  the target with a displacement of 16 or 32 bits. On the sparc, move
338
  the target with a displacement of 16 or 32 bits. On the sparc, move
339
  instructions use an offset of 14 bits, so the offset is stored in
339
  instructions use an offset of 14 bits, so the offset is stored in
340
  the reloc field, and the data in the section is ignored.  */
340
  the reloc field, and the data in the section is ignored.  */
341
 
341
 
342
/* This structure describes a single relocation to be performed.
342
/* This structure describes a single relocation to be performed.
343
   The text-relocation section of the file is a vector of these structures,
343
   The text-relocation section of the file is a vector of these structures,
344
   all of which apply to the text section.
344
   all of which apply to the text section.
345
   Likewise, the data-relocation section applies to the data section.  */
345
   Likewise, the data-relocation section applies to the data section.  */
346
 
346
 
347
struct reloc_std_external
347
struct reloc_std_external
348
{
348
{
349
  bfd_byte r_address[BYTES_IN_WORD];	/* Offset of of data to relocate.  */
349
  bfd_byte r_address[BYTES_IN_WORD];	/* Offset of of data to relocate.  */
350
  bfd_byte r_index[3];			/* Symbol table index of symbol.  */
350
  bfd_byte r_index[3];			/* Symbol table index of symbol.  */
351
  bfd_byte r_type[1];			/* Relocation type.  */
351
  bfd_byte r_type[1];			/* Relocation type.  */
352
};
352
};
353
 
353
 
354
#define	RELOC_STD_BITS_PCREL_BIG	((unsigned int) 0x80)
354
#define	RELOC_STD_BITS_PCREL_BIG	((unsigned int) 0x80)
355
#define	RELOC_STD_BITS_PCREL_LITTLE	((unsigned int) 0x01)
355
#define	RELOC_STD_BITS_PCREL_LITTLE	((unsigned int) 0x01)
356
 
356
 
357
#define	RELOC_STD_BITS_LENGTH_BIG	((unsigned int) 0x60)
357
#define	RELOC_STD_BITS_LENGTH_BIG	((unsigned int) 0x60)
358
#define	RELOC_STD_BITS_LENGTH_SH_BIG	5
358
#define	RELOC_STD_BITS_LENGTH_SH_BIG	5
359
#define	RELOC_STD_BITS_LENGTH_LITTLE	((unsigned int) 0x06)
359
#define	RELOC_STD_BITS_LENGTH_LITTLE	((unsigned int) 0x06)
360
#define	RELOC_STD_BITS_LENGTH_SH_LITTLE	1
360
#define	RELOC_STD_BITS_LENGTH_SH_LITTLE	1
361
 
361
 
362
#define	RELOC_STD_BITS_EXTERN_BIG	((unsigned int) 0x10)
362
#define	RELOC_STD_BITS_EXTERN_BIG	((unsigned int) 0x10)
363
#define	RELOC_STD_BITS_EXTERN_LITTLE	((unsigned int) 0x08)
363
#define	RELOC_STD_BITS_EXTERN_LITTLE	((unsigned int) 0x08)
364
 
364
 
365
#define	RELOC_STD_BITS_BASEREL_BIG	((unsigned int) 0x08)
365
#define	RELOC_STD_BITS_BASEREL_BIG	((unsigned int) 0x08)
366
#define	RELOC_STD_BITS_BASEREL_LITTLE	((unsigned int) 0x10)
366
#define	RELOC_STD_BITS_BASEREL_LITTLE	((unsigned int) 0x10)
367
 
367
 
368
#define	RELOC_STD_BITS_JMPTABLE_BIG	((unsigned int) 0x04)
368
#define	RELOC_STD_BITS_JMPTABLE_BIG	((unsigned int) 0x04)
369
#define	RELOC_STD_BITS_JMPTABLE_LITTLE	((unsigned int) 0x20)
369
#define	RELOC_STD_BITS_JMPTABLE_LITTLE	((unsigned int) 0x20)
370
 
370
 
371
#define	RELOC_STD_BITS_RELATIVE_BIG	((unsigned int) 0x02)
371
#define	RELOC_STD_BITS_RELATIVE_BIG	((unsigned int) 0x02)
372
#define	RELOC_STD_BITS_RELATIVE_LITTLE	((unsigned int) 0x40)
372
#define	RELOC_STD_BITS_RELATIVE_LITTLE	((unsigned int) 0x40)
373
 
373
 
374
#define	RELOC_STD_SIZE	(BYTES_IN_WORD + 3 + 1)		/* Bytes per relocation entry.  */
374
#define	RELOC_STD_SIZE	(BYTES_IN_WORD + 3 + 1)		/* Bytes per relocation entry.  */
375
 
375
 
376
struct reloc_std_internal
376
struct reloc_std_internal
377
{
377
{
378
  bfd_vma r_address;		/* Address (within segment) to be relocated.  */
378
  bfd_vma r_address;		/* Address (within segment) to be relocated.  */
379
  /* The meaning of r_symbolnum depends on r_extern.  */
379
  /* The meaning of r_symbolnum depends on r_extern.  */
380
  unsigned int r_symbolnum:24;
380
  unsigned int r_symbolnum:24;
381
  /* Nonzero means value is a pc-relative offset
381
  /* Nonzero means value is a pc-relative offset
382
     and it should be relocated for changes in its own address
382
     and it should be relocated for changes in its own address
383
     as well as for changes in the symbol or section specified.  */
383
     as well as for changes in the symbol or section specified.  */
384
  unsigned int r_pcrel:1;
384
  unsigned int r_pcrel:1;
385
  /* Length (as exponent of 2) of the field to be relocated.
385
  /* Length (as exponent of 2) of the field to be relocated.
386
     Thus, a value of 2 indicates 1<<2 bytes.  */
386
     Thus, a value of 2 indicates 1<<2 bytes.  */
387
  unsigned int r_length:2;
387
  unsigned int r_length:2;
388
  /* 1 => relocate with value of symbol.
388
  /* 1 => relocate with value of symbol.
389
     r_symbolnum is the index of the symbol
389
     r_symbolnum is the index of the symbol
390
     in files the symbol table.
390
     in files the symbol table.
391
     0 => relocate with the address of a segment.
391
     0 => relocate with the address of a segment.
392
     r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
392
     r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
393
     (the N_EXT bit may be set also, but signifies nothing).  */
393
     (the N_EXT bit may be set also, but signifies nothing).  */
394
  unsigned int r_extern:1;
394
  unsigned int r_extern:1;
395
  /* The next three bits are for SunOS shared libraries, and seem to
395
  /* The next three bits are for SunOS shared libraries, and seem to
396
     be undocumented.  */
396
     be undocumented.  */
397
  unsigned int r_baserel:1;	/* Linkage table relative.  */
397
  unsigned int r_baserel:1;	/* Linkage table relative.  */
398
  unsigned int r_jmptable:1;	/* pc-relative to jump table.  */
398
  unsigned int r_jmptable:1;	/* pc-relative to jump table.  */
399
  unsigned int r_relative:1;	/* "relative relocation".  */
399
  unsigned int r_relative:1;	/* "relative relocation".  */
400
  /* unused */
400
  /* unused */
401
  unsigned int r_pad:1;		/* Padding -- set to zero.  */
401
  unsigned int r_pad:1;		/* Padding -- set to zero.  */
402
};
402
};
403
 
403
 
404
 
404
 
405
/* EXTENDED RELOCS.   */
405
/* EXTENDED RELOCS.   */
406
 
406
 
407
struct reloc_ext_external
407
struct reloc_ext_external
408
{
408
{
409
  bfd_byte r_address[BYTES_IN_WORD];	/* Offset of of data to relocate.  */
409
  bfd_byte r_address[BYTES_IN_WORD];	/* Offset of of data to relocate.  */
410
  bfd_byte r_index[3];			/* Symbol table index of symbol.  */
410
  bfd_byte r_index[3];			/* Symbol table index of symbol.  */
411
  bfd_byte r_type[1];			/* Relocation type.  */
411
  bfd_byte r_type[1];			/* Relocation type.  */
412
  bfd_byte r_addend[BYTES_IN_WORD];	/* Datum addend.  */
412
  bfd_byte r_addend[BYTES_IN_WORD];	/* Datum addend.  */
413
};
413
};
414
 
414
 
415
#ifndef RELOC_EXT_BITS_EXTERN_BIG
415
#ifndef RELOC_EXT_BITS_EXTERN_BIG
416
#define	RELOC_EXT_BITS_EXTERN_BIG	((unsigned int) 0x80)
416
#define	RELOC_EXT_BITS_EXTERN_BIG	((unsigned int) 0x80)
417
#endif
417
#endif
418
 
418
 
419
#ifndef RELOC_EXT_BITS_EXTERN_LITTLE
419
#ifndef RELOC_EXT_BITS_EXTERN_LITTLE
420
#define	RELOC_EXT_BITS_EXTERN_LITTLE	((unsigned int) 0x01)
420
#define	RELOC_EXT_BITS_EXTERN_LITTLE	((unsigned int) 0x01)
421
#endif
421
#endif
422
 
422
 
423
#ifndef RELOC_EXT_BITS_TYPE_BIG
423
#ifndef RELOC_EXT_BITS_TYPE_BIG
424
#define	RELOC_EXT_BITS_TYPE_BIG		((unsigned int) 0x1F)
424
#define	RELOC_EXT_BITS_TYPE_BIG		((unsigned int) 0x1F)
425
#endif
425
#endif
426
 
426
 
427
#ifndef RELOC_EXT_BITS_TYPE_SH_BIG
427
#ifndef RELOC_EXT_BITS_TYPE_SH_BIG
428
#define	RELOC_EXT_BITS_TYPE_SH_BIG	0
428
#define	RELOC_EXT_BITS_TYPE_SH_BIG	0
429
#endif
429
#endif
430
 
430
 
431
#ifndef RELOC_EXT_BITS_TYPE_LITTLE
431
#ifndef RELOC_EXT_BITS_TYPE_LITTLE
432
#define	RELOC_EXT_BITS_TYPE_LITTLE	((unsigned int) 0xF8)
432
#define	RELOC_EXT_BITS_TYPE_LITTLE	((unsigned int) 0xF8)
433
#endif
433
#endif
434
 
434
 
435
#ifndef RELOC_EXT_BITS_TYPE_SH_LITTLE
435
#ifndef RELOC_EXT_BITS_TYPE_SH_LITTLE
436
#define	RELOC_EXT_BITS_TYPE_SH_LITTLE	3
436
#define	RELOC_EXT_BITS_TYPE_SH_LITTLE	3
437
#endif
437
#endif
438
 
438
 
439
/* Bytes per relocation entry.  */
439
/* Bytes per relocation entry.  */
440
#define	RELOC_EXT_SIZE	(BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
440
#define	RELOC_EXT_SIZE	(BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
441
 
441
 
442
enum reloc_type
442
enum reloc_type
443
{
443
{
444
  /* Simple relocations.  */
444
  /* Simple relocations.  */
445
  RELOC_8,			/* data[0:7] = addend + sv 		*/
445
  RELOC_8,			/* data[0:7] = addend + sv 		*/
446
  RELOC_16,			/* data[0:15] = addend + sv 		*/
446
  RELOC_16,			/* data[0:15] = addend + sv 		*/
447
  RELOC_32,			/* data[0:31] = addend + sv 		*/
447
  RELOC_32,			/* data[0:31] = addend + sv 		*/
448
  /* PC-rel displacement.  */
448
  /* PC-rel displacement.  */
449
  RELOC_DISP8,			/* data[0:7] = addend - pc + sv 	*/
449
  RELOC_DISP8,			/* data[0:7] = addend - pc + sv 	*/
450
  RELOC_DISP16,			/* data[0:15] = addend - pc + sv 	*/
450
  RELOC_DISP16,			/* data[0:15] = addend - pc + sv 	*/
451
  RELOC_DISP32,			/* data[0:31] = addend - pc + sv 	*/
451
  RELOC_DISP32,			/* data[0:31] = addend - pc + sv 	*/
452
  /* Special.  */
452
  /* Special.  */
453
  RELOC_WDISP30,		/* data[0:29] = (addend + sv - pc)>>2 	*/
453
  RELOC_WDISP30,		/* data[0:29] = (addend + sv - pc)>>2 	*/
454
  RELOC_WDISP22,		/* data[0:21] = (addend + sv - pc)>>2 	*/
454
  RELOC_WDISP22,		/* data[0:21] = (addend + sv - pc)>>2 	*/
455
  RELOC_HI22,			/* data[0:21] = (addend + sv)>>10 	*/
455
  RELOC_HI22,			/* data[0:21] = (addend + sv)>>10 	*/
456
  RELOC_22,			/* data[0:21] = (addend + sv) 		*/
456
  RELOC_22,			/* data[0:21] = (addend + sv) 		*/
457
  RELOC_13,			/* data[0:12] = (addend + sv)		*/
457
  RELOC_13,			/* data[0:12] = (addend + sv)		*/
458
  RELOC_LO10,			/* data[0:9] = (addend + sv)		*/
458
  RELOC_LO10,			/* data[0:9] = (addend + sv)		*/
459
  RELOC_SFA_BASE,		
459
  RELOC_SFA_BASE,		
460
  RELOC_SFA_OFF13,
460
  RELOC_SFA_OFF13,
461
  /* P.I.C. (base-relative).  */
461
  /* P.I.C. (base-relative).  */
462
  RELOC_BASE10,  		/* Not sure - maybe we can do this the */
462
  RELOC_BASE10,  		/* Not sure - maybe we can do this the */
463
  RELOC_BASE13,			/* right way now */
463
  RELOC_BASE13,			/* right way now */
464
  RELOC_BASE22,
464
  RELOC_BASE22,
465
  /* For some sort of pc-rel P.I.C. (?)  */
465
  /* For some sort of pc-rel P.I.C. (?)  */
466
  RELOC_PC10,
466
  RELOC_PC10,
467
  RELOC_PC22,
467
  RELOC_PC22,
468
  /* P.I.C. jump table.  */
468
  /* P.I.C. jump table.  */
469
  RELOC_JMP_TBL,
469
  RELOC_JMP_TBL,
470
  /* Reputedly for shared libraries somehow.  */
470
  /* Reputedly for shared libraries somehow.  */
471
  RELOC_SEGOFF16,
471
  RELOC_SEGOFF16,
472
  RELOC_GLOB_DAT,
472
  RELOC_GLOB_DAT,
473
  RELOC_JMP_SLOT,
473
  RELOC_JMP_SLOT,
474
  RELOC_RELATIVE,
474
  RELOC_RELATIVE,
475
 
475
 
476
  RELOC_11,	
476
  RELOC_11,	
477
  RELOC_WDISP2_14,
477
  RELOC_WDISP2_14,
478
  RELOC_WDISP19,
478
  RELOC_WDISP19,
479
  RELOC_HHI22,			/* data[0:21] = (addend + sv) >> 42     */
479
  RELOC_HHI22,			/* data[0:21] = (addend + sv) >> 42     */
480
  RELOC_HLO10,			/* data[0:9] = (addend + sv) >> 32      */
480
  RELOC_HLO10,			/* data[0:9] = (addend + sv) >> 32      */
481
  
481
  
482
  /* 29K relocation types.  */
482
  /* 29K relocation types.  */
483
  RELOC_JUMPTARG,
483
  RELOC_JUMPTARG,
484
  RELOC_CONST,
484
  RELOC_CONST,
485
  RELOC_CONSTH,
485
  RELOC_CONSTH,
486
  
486
  
487
  /* All the new ones I can think of, for sparc v9.  */
487
  /* All the new ones I can think of, for sparc v9.  */
488
  RELOC_64,			/* data[0:63] = addend + sv 		*/
488
  RELOC_64,			/* data[0:63] = addend + sv 		*/
489
  RELOC_DISP64,			/* data[0:63] = addend - pc + sv 	*/
489
  RELOC_DISP64,			/* data[0:63] = addend - pc + sv 	*/
490
  RELOC_WDISP21,		/* data[0:20] = (addend + sv - pc)>>2 	*/
490
  RELOC_WDISP21,		/* data[0:20] = (addend + sv - pc)>>2 	*/
491
  RELOC_DISP21,			/* data[0:20] = addend - pc + sv        */
491
  RELOC_DISP21,			/* data[0:20] = addend - pc + sv        */
492
  RELOC_DISP14,			/* data[0:13] = addend - pc + sv 	*/
492
  RELOC_DISP14,			/* data[0:13] = addend - pc + sv 	*/
493
  /* Q .
493
  /* Q .
494
     What are the other ones,
494
     What are the other ones,
495
     Since this is a clean slate, can we throw away the ones we dont
495
     Since this is a clean slate, can we throw away the ones we dont
496
     understand ? Should we sort the values ? What about using a
496
     understand ? Should we sort the values ? What about using a
497
     microcode format like the 68k ?  */
497
     microcode format like the 68k ?  */
498
  NO_RELOC
498
  NO_RELOC
499
  };
499
  };
500
 
500
 
501
 
501
 
502
struct reloc_internal
502
struct reloc_internal
503
{
503
{
504
  bfd_vma r_address;		/* Offset of of data to relocate.  */
504
  bfd_vma r_address;		/* Offset of of data to relocate.  */
505
  long	r_index;		/* Symbol table index of symbol.  */
505
  long	r_index;		/* Symbol table index of symbol.  */
506
  enum reloc_type r_type;	/* Relocation type.  */
506
  enum reloc_type r_type;	/* Relocation type.  */
507
  bfd_vma r_addend;		/* Datum addend.  */
507
  bfd_vma r_addend;		/* Datum addend.  */
508
};
508
};
509
 
509
 
510
/* Q.
510
/* Q.
511
   Should the length of the string table be 4 bytes or 8 bytes ?
511
   Should the length of the string table be 4 bytes or 8 bytes ?
512
 
512
 
513
   Q.
513
   Q.
514
   What about archive indexes ?  */
514
   What about archive indexes ?  */
515
 
515
 
516
#endif				/* __A_OUT_64_H__ */
516
#endif				/* __A_OUT_64_H__ */