forked from Leffmann/vlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_aoutm68k.c
325 lines (298 loc) · 5.82 KB
/
t_aoutm68k.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/* $VER: vlink t_aoutm68k.c V0.13 (02.11.10)
*
* This file is part of vlink, a portable linker for multiple
* object formats.
* Copyright (c) 1997-2010 Frank Wille
*/
#include "config.h"
#if defined(AOUT_BSDM68K) || defined(AOUT_BSDM68K4K) || \
defined(AOUT_SUN010) || defined(AOUT_SUN020) || defined(AOUT_JAGUAR)
#define T_AOUTM68K_C
#include "vlink.h"
#include "aout.h"
static const char zmagic_exe1[] = {
"SECTIONS\n"
"{\n"
" . = 0x1020;\n"
" .text :\n"
" {\n"
" /*CREATE_OBJECT_SYMBOLS*/\n"
" *(.text)\n"
" *(.dynrel)\n"
" *(.hash)\n"
" *(.dynsym)\n"
" *(.dynstr)\n"
" *(.rules)\n"
" *(.need)\n"
" _etext = .;\n"
" __etext = .;\n"
" }\n"
" . = ALIGN(0x1000);\n"
" .data :\n"
" {\n"
" *(.dynamic)\n"
" *(.got)\n"
" *(.plt)\n"
" *(.data)\n"
" /*CONSTRUCTORS*/\n"
" _edata = .;\n"
" __edata = .;\n"
" }\n"
" .bss :\n"
" {\n"
" __bss_start = .;\n"
" *(.bss)\n"
" *(COMMON)\n"
" _end = ALIGN(4);\n"
" __end = ALIGN(4);\n"
" }\n"
"}\n"
};
static const char zmagic_exe2[] = {
"SECTIONS\n"
"{\n"
" . = 0x2020;\n"
" .text :\n"
" {\n"
" /*CREATE_OBJECT_SYMBOLS*/\n"
" *(.text)\n"
" *(.dynrel)\n"
" *(.hash)\n"
" *(.dynsym)\n"
" *(.dynstr)\n"
" *(.rules)\n"
" *(.need)\n"
" _etext = .;\n"
" __etext = .;\n"
" }\n"
" . = ALIGN(0x2000);\n"
" .data :\n"
" {\n"
" *(.dynamic)\n"
" *(.got)\n"
" *(.plt)\n"
" *(.data)\n"
" /*CONSTRUCTORS*/\n"
" _edata = .;\n"
" __edata = .;\n"
" }\n"
" .bss :\n"
" {\n"
" __bss_start = .;\n"
" *(.bss)\n"
" *(COMMON)\n"
" _end = ALIGN(4);\n"
" __end = ALIGN(4);\n"
" }\n"
"}\n"
};
#ifdef AOUT_BSDM68K
static int aoutbsd68k_identify(char *,uint8_t *,unsigned long,bool);
struct FFFuncs fff_aoutbsd68k = {
"aoutbsd68k",
zmagic_exe2,
NULL,
NULL,
aout_headersize,
aoutbsd68k_identify,
aoutstd_readconv,
NULL,
aout_targetlink,
NULL,
aout_lnksym,
aout_setlnksym,
NULL,NULL,NULL,
aoutstd_writeobject,
aoutstd_writeshared,
aoutstd_writeexec,
bss_name,NULL,
0x2000,
0x8000, /* @@@ ? */
0,
MID_M68K,
RTAB_STANDARD,RTAB_STANDARD,
_BIG_ENDIAN_,
32,
FFF_BASEINCR
};
#endif
#ifdef AOUT_BSDM68K4K
static int aoutbsd68k4k_identify(char *,uint8_t *,unsigned long,bool);
struct FFFuncs fff_aoutbsd68k4k = {
"aoutbsd68k4k",
zmagic_exe1,
NULL,
NULL,
aout_headersize,
aoutbsd68k4k_identify,
aoutstd_readconv,
NULL,
aout_targetlink,
NULL,
aout_lnksym,
aout_setlnksym,
NULL,NULL,NULL,
aoutstd_writeobject,
aoutstd_writeshared,
aoutstd_writeexec,
bss_name,NULL,
0x1000,
0x8000, /* @@@ ? */
0,
MID_M68K4K,
RTAB_STANDARD,RTAB_STANDARD,
_BIG_ENDIAN_,
32,
FFF_BASEINCR
};
#endif
#ifdef AOUT_SUN010
static int aoutsun010_identify(char *,uint8_t *,unsigned long,bool);
struct FFFuncs fff_aoutsun010 = {
"aoutsun010",
zmagic_exe2,
NULL,
NULL,
aout_headersize,
aoutsun010_identify,
aoutstd_readconv,
NULL,
aout_targetlink,
NULL,
aout_lnksym,
aout_setlnksym,
NULL,NULL,NULL,
aoutstd_writeobject,
aoutstd_writeshared,
aoutstd_writeexec,
bss_name,NULL,
0x2000,
0x8000, /* @@@ ? */
0,
MID_SUN010,
RTAB_STANDARD,RTAB_STANDARD,
_BIG_ENDIAN_,
32,
FFF_BASEINCR
};
#endif
#ifdef AOUT_SUN020
static int aoutsun020_identify(char *,uint8_t *,unsigned long,bool);
struct FFFuncs fff_aoutsun020 = {
"aoutsun020",
zmagic_exe2,
NULL,
NULL,
aout_headersize,
aoutsun020_identify,
aoutstd_readconv,
NULL,
aout_targetlink,
NULL,
aout_lnksym,
aout_setlnksym,
NULL,NULL,NULL,
aoutstd_writeobject,
aoutstd_writeshared,
aoutstd_writeexec,
bss_name,NULL,
0x2000,
0x8000, /* @@@ ? */
0,
MID_SUN020,
RTAB_STANDARD,RTAB_STANDARD,
_BIG_ENDIAN_,
32,
FFF_BASEINCR
};
#endif
#ifdef AOUT_JAGUAR
static const char jaguar_exe[] = {
"SECTIONS\n"
"{\n"
" . = 0x4020;\n"
" .text :\n"
" {\n"
" *(.text)\n"
" _etext = .;\n"
" __etext = .;\n"
" }\n"
" . = ALIGN(4);\n"
" .data :\n"
" {\n"
" *(.data)\n"
" VBCC_CONSTRUCTORS\n"
" _edata = .;\n"
" __edata = .;\n"
" }\n"
" . = ALIGN(4);\n"
" .bss :\n"
" {\n"
" __bss_start = .;\n"
" *(.bss)\n"
" *(COMMON)\n"
" _end = ALIGN(4);\n"
" __end = ALIGN(4);\n"
" }\n"
"}\n"
};
static int aoutjaguar_identify(char *,uint8_t *,unsigned long,bool);
struct FFFuncs fff_aoutjaguar = {
"aoutjaguar",
jaguar_exe,
NULL,
NULL,
aout_headersize,
aoutjaguar_identify, /* NULL */
NULL,
NULL,
aout_targetlink, /* NULL */
NULL,
aout_lnksym,
aout_setlnksym,
NULL,NULL,NULL,
aoutstd_writeobject,
aoutstd_writeshared,
aoutstd_writeexec,
bss_name,NULL,
0x1000,
0x8000, /* @@@ ? */
0,
0, /* MID 0! */
RTAB_STANDARD,RTAB_STANDARD,
_BIG_ENDIAN_,
32,
FFF_BASEINCR|AOUT_JAGRELOC
};
#endif
#ifdef AOUT_BSDM68K
static int aoutbsd68k_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
{
return aout_identify(&fff_aoutbsd68k,name,(struct aout_hdr *)p,plen);
}
#endif
#ifdef AOUT_BSDM68K4K
static int aoutbsd68k4k_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
{
return aout_identify(&fff_aoutbsd68k4k,name,(struct aout_hdr *)p,plen);
}
#endif
#ifdef AOUT_SUN010
static int aoutsun010_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
{
return aout_identify(&fff_aoutsun010,name,(struct aout_hdr *)p,plen);
}
#endif
#ifdef AOUT_SUN020
static int aoutsun020_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
{
return aout_identify(&fff_aoutsun020,name,(struct aout_hdr *)p,plen);
}
#endif
#ifdef AOUT_JAGUAR
static int aoutjaguar_identify(char *name,uint8_t *p,unsigned long plen,bool lib)
{
return ID_UNKNOWN; /* object are read as aoutnull */
}
#endif
#endif