]>
Commit | Line | Data |
---|---|---|
6812b607 | 1 | /* BFD back-end for Intel 960 COFF files. |
943fbd5b | 2 | Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. |
3b4f1a5d | 3 | Written by Cygnus Support. |
fc723380 | 4 | |
3b4f1a5d | 5 | This file is part of BFD, the Binary File Descriptor library. |
4a81b561 | 6 | |
3b4f1a5d | 7 | This program is free software; you can redistribute it and/or modify |
4a81b561 | 8 | it under the terms of the GNU General Public License as published by |
3b4f1a5d SC |
9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | |
4a81b561 | 11 | |
3b4f1a5d | 12 | This program is distributed in the hope that it will be useful, |
4a81b561 DHW |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
3b4f1a5d | 18 | along with this program; if not, write to the Free Software |
943fbd5b | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
4a81b561 | 20 | |
4a81b561 | 21 | #define I960 1 |
fc723380 JG |
22 | #define BADMAG(x) I960BADMAG(x) |
23 | ||
4a81b561 | 24 | #include "bfd.h" |
3b4f1a5d | 25 | #include "sysdep.h" |
4a81b561 | 26 | #include "libbfd.h" |
9872a49c | 27 | #include "obstack.h" |
8070f29d KR |
28 | #include "coff/i960.h" |
29 | #include "coff/internal.h" | |
4a81b561 | 30 | #include "libcoff.h" /* to allow easier abstraction-breaking */ |
6812b607 ILT |
31 | |
32 | static bfd_reloc_status_type optcall_callback | |
33 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
5e694c29 JMD |
34 | static bfd_reloc_status_type coff_i960_relocate |
35 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
a208a70f ILT |
36 | static reloc_howto_type *coff_i960_reloc_type_lookup |
37 | PARAMS ((bfd *, bfd_reloc_code_real_type)); | |
38 | static boolean coff_i960_start_final_link | |
39 | PARAMS ((bfd *, struct bfd_link_info *)); | |
40 | static boolean coff_i960_relocate_section | |
41 | PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, | |
42 | struct internal_reloc *, struct internal_syment *, asection **)); | |
43 | static boolean coff_i960_adjust_symndx | |
44 | PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, | |
45 | struct internal_reloc *, boolean *)); | |
5e694c29 | 46 | |
943fbd5b KR |
47 | #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3) |
48 | ||
49 | /* The i960 does not support an MMU, so COFF_PAGE_SIZE can be | |
50 | arbitrarily small. */ | |
51 | #define COFF_PAGE_SIZE 1 | |
52 | ||
294eaca4 | 53 | #define COFF_LONG_FILENAMES |
4a81b561 | 54 | |
4a81b561 DHW |
55 | #define CALLS 0x66003800 /* Template for 'calls' instruction */ |
56 | #define BAL 0x0b000000 /* Template for 'bal' instruction */ | |
57 | #define BAL_MASK 0x00ffffff | |
58 | ||
3b4f1a5d | 59 | static bfd_reloc_status_type |
6812b607 | 60 | optcall_callback (abfd, reloc_entry, symbol_in, data, |
943fbd5b | 61 | input_section, ignore_bfd, error_message) |
6812b607 ILT |
62 | bfd *abfd; |
63 | arelent *reloc_entry; | |
64 | asymbol *symbol_in; | |
65 | PTR data; | |
943fbd5b | 66 | asection *input_section; |
6812b607 ILT |
67 | bfd *ignore_bfd; |
68 | char **error_message; | |
4a81b561 DHW |
69 | { |
70 | /* This item has already been relocated correctly, but we may be | |
71 | * able to patch in yet better code - done by digging out the | |
72 | * correct info on this symbol */ | |
3b4f1a5d | 73 | bfd_reloc_status_type result; |
4a81b561 DHW |
74 | coff_symbol_type *cs = coffsymbol(symbol_in); |
75 | ||
943fbd5b KR |
76 | /* Don't do anything with symbols which aren't tied up yet, |
77 | except move the reloc. */ | |
78 | if (bfd_is_und_section (cs->symbol.section)) { | |
79 | reloc_entry->address += input_section->output_offset; | |
80 | return bfd_reloc_ok; | |
81 | } | |
82 | ||
fc723380 JG |
83 | /* So the target symbol has to be of coff type, and the symbol |
84 | has to have the correct native information within it */ | |
6812b607 ILT |
85 | if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour) |
86 | || (cs->native == (combined_entry_type *)NULL)) | |
87 | { | |
88 | /* This is interesting, consider the case where we're outputting coff | |
89 | from a mix n match input, linking from coff to a symbol defined in a | |
90 | bout file will cause this match to be true. Should I complain? This | |
91 | will only work if the bout symbol is non leaf. */ | |
92 | *error_message = | |
93 | (char *) "uncertain calling convention for non-COFF symbol"; | |
94 | result = bfd_reloc_dangerous; | |
95 | } | |
96 | else | |
97 | { | |
3b4f1a5d | 98 | switch (cs->native->u.syment.n_sclass) |
4a81b561 DHW |
99 | { |
100 | case C_LEAFSTAT: | |
101 | case C_LEAFEXT: | |
102 | /* This is a call to a leaf procedure, replace instruction with a bal | |
6812b607 | 103 | to the correct location. */ |
4a81b561 | 104 | { |
3b4f1a5d | 105 | union internal_auxent *aux = &((cs->native+2)->u.auxent); |
8070f29d | 106 | int word = bfd_get_32(abfd, (bfd_byte *)data + reloc_entry->address); |
3b4f1a5d SC |
107 | int olf = (aux->x_bal.x_balntry - cs->native->u.syment.n_value); |
108 | BFD_ASSERT(cs->native->u.syment.n_numaux==2); | |
8e3c8f47 | 109 | |
6812b607 ILT |
110 | /* We replace the original call instruction with a bal to |
111 | the bal entry point - the offset of which is described in | |
112 | the 2nd auxent of the original symbol. We keep the native | |
113 | sym and auxents untouched, so the delta between the two | |
114 | is the offset of the bal entry point. */ | |
8e3c8f47 | 115 | word = ((word + olf) & BAL_MASK) | BAL; |
8070f29d | 116 | bfd_put_32(abfd, word, (bfd_byte *) data + reloc_entry->address); |
4a81b561 DHW |
117 | } |
118 | result = bfd_reloc_ok; | |
119 | break; | |
120 | case C_SCALL: | |
3b4f1a5d SC |
121 | /* This is a call to a system call, replace with a calls to # */ |
122 | BFD_ASSERT(0); | |
123 | result = bfd_reloc_ok; | |
4a81b561 DHW |
124 | break; |
125 | default: | |
126 | result = bfd_reloc_ok; | |
127 | break; | |
128 | } | |
129 | } | |
130 | return result; | |
131 | } | |
132 | ||
1b8a11d4 JMD |
133 | /* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not |
134 | appear to correctly handle a reloc against a symbol defined in the | |
135 | same object file. It appears to simply discard such relocs, rather | |
136 | than adding their values into the object file. We handle this here | |
137 | by converting all relocs against defined symbols into relocs | |
138 | against the section symbol, when generating a relocateable output | |
a208a70f ILT |
139 | file. |
140 | ||
141 | Note that this function is only called if we are not using the COFF | |
142 | specific backend linker. It only does something when doing a | |
143 | relocateable link, which will almost certainly fail when not | |
144 | generating COFF i960 output, so this function is actually no longer | |
145 | useful. It was used before this target was converted to use the | |
146 | COFF specific backend linker. */ | |
5e694c29 JMD |
147 | |
148 | static bfd_reloc_status_type | |
149 | coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section, | |
150 | output_bfd, error_message) | |
151 | bfd *abfd; | |
152 | arelent *reloc_entry; | |
153 | asymbol *symbol; | |
154 | PTR data; | |
155 | asection *input_section; | |
156 | bfd *output_bfd; | |
157 | char **error_message; | |
158 | { | |
943fbd5b | 159 | asection *osec; |
1b8a11d4 JMD |
160 | |
161 | if (output_bfd == NULL) | |
5e694c29 | 162 | { |
1b8a11d4 JMD |
163 | /* Not generating relocateable output file. */ |
164 | return bfd_reloc_continue; | |
5e694c29 JMD |
165 | } |
166 | ||
1b8a11d4 JMD |
167 | if (bfd_is_und_section (bfd_get_section (symbol))) |
168 | { | |
169 | /* Symbol is not defined, so no need to worry about it. */ | |
170 | return bfd_reloc_continue; | |
171 | } | |
172 | ||
943fbd5b KR |
173 | if (bfd_is_com_section (bfd_get_section (symbol))) |
174 | { | |
175 | /* I don't really know what the right action is for a common | |
176 | symbol. */ | |
177 | return bfd_reloc_continue; | |
178 | } | |
179 | ||
1b8a11d4 | 180 | /* Convert the reloc to use the section symbol. FIXME: This method |
a208a70f | 181 | is ridiculous. */ |
943fbd5b | 182 | osec = bfd_get_section (symbol)->output_section; |
a208a70f ILT |
183 | if (coff_section_data (output_bfd, osec) != NULL |
184 | && coff_section_data (output_bfd, osec)->tdata != NULL) | |
185 | reloc_entry->sym_ptr_ptr = | |
186 | (asymbol **) coff_section_data (output_bfd, osec)->tdata; | |
943fbd5b | 187 | else |
1b8a11d4 | 188 | { |
943fbd5b KR |
189 | const char *sec_name; |
190 | asymbol **syms, **sym_end; | |
191 | ||
192 | sec_name = bfd_get_section_name (output_bfd, osec); | |
193 | syms = bfd_get_outsymbols (output_bfd); | |
194 | sym_end = syms + bfd_get_symcount (output_bfd); | |
195 | for (; syms < sym_end; syms++) | |
1b8a11d4 | 196 | { |
943fbd5b KR |
197 | if (bfd_asymbol_name (*syms) != NULL |
198 | && (*syms)->value == 0 | |
a208a70f ILT |
199 | && strcmp ((*syms)->section->output_section->name, |
200 | sec_name) == 0) | |
201 | break; | |
1b8a11d4 | 202 | } |
1b8a11d4 | 203 | |
943fbd5b KR |
204 | if (syms >= sym_end) |
205 | abort (); | |
a208a70f ILT |
206 | |
207 | reloc_entry->sym_ptr_ptr = syms; | |
208 | ||
209 | if (coff_section_data (output_bfd, osec) == NULL) | |
210 | { | |
211 | osec->used_by_bfd = | |
212 | ((PTR) bfd_zalloc (abfd, | |
213 | sizeof (struct coff_section_tdata))); | |
214 | if (osec->used_by_bfd == NULL) | |
a9713b91 | 215 | return bfd_reloc_overflow; |
a208a70f ILT |
216 | } |
217 | coff_section_data (output_bfd, osec)->tdata = (PTR) syms; | |
943fbd5b | 218 | } |
1b8a11d4 JMD |
219 | |
220 | /* Let bfd_perform_relocation do its thing, which will include | |
221 | stuffing the symbol addend into the object file. */ | |
5e694c29 JMD |
222 | return bfd_reloc_continue; |
223 | } | |
224 | ||
8070f29d | 225 | static reloc_howto_type howto_rellong = |
ffeef0bb | 226 | HOWTO ((unsigned int) R_RELLONG, 0, 2, 32,false, 0, |
5e694c29 JMD |
227 | complain_overflow_bitfield, coff_i960_relocate,"rellong", true, |
228 | 0xffffffff, 0xffffffff, 0); | |
8070f29d | 229 | static reloc_howto_type howto_iprmed = |
5e694c29 JMD |
230 | HOWTO (R_IPRMED, 0, 2, 24,true,0, complain_overflow_signed, |
231 | coff_i960_relocate, "iprmed ", true, 0x00ffffff, 0x00ffffff, 0); | |
8070f29d | 232 | static reloc_howto_type howto_optcall = |
ffeef0bb KR |
233 | HOWTO (R_OPTCALL, 0,2,24,true,0, complain_overflow_signed, |
234 | optcall_callback, "optcall", true, 0x00ffffff, 0x00ffffff, 0); | |
4a81b561 | 235 | |
943fbd5b | 236 | static reloc_howto_type * |
6812b607 ILT |
237 | coff_i960_reloc_type_lookup (abfd, code) |
238 | bfd *abfd; | |
239 | bfd_reloc_code_real_type code; | |
8070f29d KR |
240 | { |
241 | switch (code) | |
242 | { | |
243 | default: | |
244 | return 0; | |
245 | case BFD_RELOC_I960_CALLJ: | |
246 | return &howto_optcall; | |
247 | case BFD_RELOC_32: | |
22aabad5 | 248 | case BFD_RELOC_CTOR: |
8070f29d KR |
249 | return &howto_rellong; |
250 | case BFD_RELOC_24_PCREL: | |
251 | return &howto_iprmed; | |
252 | } | |
253 | } | |
4a81b561 | 254 | |
924bbb38 | 255 | /* The real code is in coffcode.h */ |
4a81b561 | 256 | |
3b4f1a5d | 257 | #define RTYPE2HOWTO(cache_ptr, dst) \ |
8070f29d KR |
258 | { \ |
259 | reloc_howto_type *howto_ptr; \ | |
260 | switch ((dst)->r_type) { \ | |
261 | case 17: howto_ptr = &howto_rellong; break; \ | |
262 | case 25: howto_ptr = &howto_iprmed; break; \ | |
263 | case 27: howto_ptr = &howto_optcall; break; \ | |
264 | default: howto_ptr = 0; break; \ | |
265 | } \ | |
943fbd5b | 266 | (cache_ptr)->howto = howto_ptr; \ |
8070f29d | 267 | } |
3b4f1a5d | 268 | |
a208a70f ILT |
269 | /* i960 COFF is used by VxWorks 5.1. However, VxWorks 5.1 does not |
270 | appear to correctly handle a reloc against a symbol defined in the | |
271 | same object file. It appears to simply discard such relocs, rather | |
272 | than adding their values into the object file. We handle this by | |
273 | converting all relocs against global symbols into relocs against | |
274 | internal symbols at the start of the section. This routine is | |
275 | called at the start of the linking process, and it creates the | |
276 | necessary symbols. */ | |
277 | ||
278 | static boolean | |
279 | coff_i960_start_final_link (abfd, info) | |
280 | bfd *abfd; | |
281 | struct bfd_link_info *info; | |
282 | { | |
283 | bfd_size_type symesz = bfd_coff_symesz (abfd); | |
284 | asection *o; | |
285 | bfd_byte *esym; | |
286 | ||
287 | if (! info->relocateable) | |
288 | return true; | |
289 | ||
58142f10 | 290 | esym = (bfd_byte *) bfd_malloc (symesz); |
a208a70f | 291 | if (esym == NULL) |
58142f10 | 292 | return false; |
a208a70f ILT |
293 | |
294 | if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0) | |
295 | return false; | |
296 | ||
297 | for (o = abfd->sections; o != NULL; o = o->next) | |
298 | { | |
299 | struct internal_syment isym; | |
300 | ||
301 | strncpy (isym._n._n_name, o->name, SYMNMLEN); | |
302 | isym.n_value = 0; | |
303 | isym.n_scnum = o->target_index; | |
304 | isym.n_type = T_NULL; | |
305 | isym.n_sclass = C_STAT; | |
306 | isym.n_numaux = 0; | |
307 | ||
308 | bfd_coff_swap_sym_out (abfd, (PTR) &isym, (PTR) esym); | |
309 | ||
310 | if (bfd_write (esym, symesz, 1, abfd) != symesz) | |
311 | { | |
312 | free (esym); | |
313 | return false; | |
314 | } | |
315 | ||
316 | obj_raw_syment_count (abfd) += 1; | |
317 | } | |
318 | ||
319 | free (esym); | |
320 | ||
321 | return true; | |
322 | } | |
323 | ||
324 | /* The reloc processing routine for the optimized COFF linker. */ | |
325 | ||
326 | static boolean | |
327 | coff_i960_relocate_section (output_bfd, info, input_bfd, input_section, | |
328 | contents, relocs, syms, sections) | |
329 | bfd *output_bfd; | |
330 | struct bfd_link_info *info; | |
331 | bfd *input_bfd; | |
332 | asection *input_section; | |
333 | bfd_byte *contents; | |
334 | struct internal_reloc *relocs; | |
335 | struct internal_syment *syms; | |
336 | asection **sections; | |
337 | { | |
338 | struct internal_reloc *rel; | |
339 | struct internal_reloc *relend; | |
340 | ||
341 | rel = relocs; | |
342 | relend = rel + input_section->reloc_count; | |
343 | for (; rel < relend; rel++) | |
344 | { | |
345 | long symndx; | |
346 | struct coff_link_hash_entry *h; | |
347 | struct internal_syment *sym; | |
348 | bfd_vma addend; | |
349 | bfd_vma val; | |
350 | reloc_howto_type *howto; | |
351 | bfd_reloc_status_type rstat = bfd_reloc_ok; | |
352 | boolean done; | |
353 | ||
354 | symndx = rel->r_symndx; | |
355 | ||
356 | if (symndx == -1) | |
357 | { | |
358 | h = NULL; | |
359 | sym = NULL; | |
360 | } | |
361 | else | |
362 | { | |
363 | h = obj_coff_sym_hashes (input_bfd)[symndx]; | |
364 | sym = syms + symndx; | |
365 | } | |
366 | ||
367 | if (sym != NULL && sym->n_scnum != 0) | |
368 | addend = - sym->n_value; | |
369 | else | |
370 | addend = 0; | |
371 | ||
372 | switch (rel->r_type) | |
373 | { | |
374 | case 17: howto = &howto_rellong; break; | |
375 | case 25: howto = &howto_iprmed; break; | |
376 | case 27: howto = &howto_optcall; break; | |
377 | default: | |
378 | bfd_set_error (bfd_error_bad_value); | |
379 | return false; | |
380 | } | |
381 | ||
382 | val = 0; | |
383 | ||
384 | if (h == NULL) | |
385 | { | |
386 | asection *sec; | |
387 | ||
388 | if (symndx == -1) | |
389 | { | |
390 | sec = bfd_abs_section_ptr; | |
391 | val = 0; | |
392 | } | |
393 | else | |
394 | { | |
395 | sec = sections[symndx]; | |
396 | val = (sec->output_section->vma | |
397 | + sec->output_offset | |
398 | + sym->n_value | |
399 | - sec->vma); | |
400 | } | |
401 | } | |
402 | else | |
403 | { | |
404 | if (h->root.type == bfd_link_hash_defined | |
405 | || h->root.type == bfd_link_hash_defweak) | |
406 | { | |
407 | asection *sec; | |
408 | ||
409 | sec = h->root.u.def.section; | |
410 | val = (h->root.u.def.value | |
411 | + sec->output_section->vma | |
412 | + sec->output_offset); | |
413 | } | |
414 | else if (! info->relocateable) | |
415 | { | |
416 | if (! ((*info->callbacks->undefined_symbol) | |
417 | (info, h->root.root.string, input_bfd, input_section, | |
418 | rel->r_vaddr - input_section->vma))) | |
419 | return false; | |
420 | } | |
421 | } | |
422 | ||
423 | done = false; | |
424 | ||
425 | if (howto->type == R_OPTCALL && ! info->relocateable && symndx != -1) | |
426 | { | |
427 | int class; | |
428 | ||
429 | if (h != NULL) | |
430 | class = h->class; | |
431 | else | |
432 | class = sym->n_sclass; | |
433 | ||
434 | switch (class) | |
435 | { | |
436 | case C_NULL: | |
437 | /* This symbol is apparently not from a COFF input file. | |
438 | We warn, and then assume that it is not a leaf | |
439 | function. */ | |
440 | if (! ((*info->callbacks->reloc_dangerous) | |
441 | (info, | |
442 | "uncertain calling convention for non-COFF symbol", | |
443 | input_bfd, input_section, | |
444 | rel->r_vaddr - input_section->vma))) | |
445 | return false; | |
446 | break; | |
447 | case C_LEAFSTAT: | |
448 | case C_LEAFEXT: | |
449 | /* This is a call to a leaf procedure; use the bal | |
450 | instruction. */ | |
451 | { | |
452 | long olf; | |
453 | unsigned long word; | |
454 | ||
455 | if (h != NULL) | |
456 | { | |
457 | BFD_ASSERT (h->numaux == 2); | |
458 | olf = h->aux[1].x_bal.x_balntry; | |
459 | } | |
460 | else | |
461 | { | |
462 | bfd_byte *esyms; | |
463 | union internal_auxent aux; | |
464 | ||
465 | BFD_ASSERT (sym->n_numaux == 2); | |
466 | esyms = (bfd_byte *) obj_coff_external_syms (input_bfd); | |
467 | esyms += (symndx + 2) * bfd_coff_symesz (input_bfd); | |
468 | bfd_coff_swap_aux_in (input_bfd, (PTR) esyms, sym->n_type, | |
469 | sym->n_sclass, 1, sym->n_numaux, | |
470 | (PTR) &aux); | |
471 | olf = aux.x_bal.x_balntry; | |
472 | } | |
473 | ||
474 | word = bfd_get_32 (input_bfd, | |
475 | (contents | |
476 | + (rel->r_vaddr - input_section->vma))); | |
477 | word = ((word + olf - val) & BAL_MASK) | BAL; | |
478 | bfd_put_32 (input_bfd, | |
479 | word, | |
480 | (contents | |
481 | + (rel->r_vaddr - input_section->vma))); | |
482 | done = true; | |
483 | } | |
484 | break; | |
485 | case C_SCALL: | |
486 | BFD_ASSERT (0); | |
487 | break; | |
488 | } | |
489 | } | |
490 | ||
491 | if (! done) | |
492 | rstat = _bfd_final_link_relocate (howto, input_bfd, input_section, | |
493 | contents, | |
494 | rel->r_vaddr - input_section->vma, | |
495 | val, addend); | |
496 | ||
497 | switch (rstat) | |
498 | { | |
499 | default: | |
500 | abort (); | |
501 | case bfd_reloc_ok: | |
502 | break; | |
503 | case bfd_reloc_overflow: | |
504 | { | |
505 | const char *name; | |
506 | char buf[SYMNMLEN + 1]; | |
507 | ||
508 | if (symndx == -1) | |
509 | name = "*ABS*"; | |
510 | else if (h != NULL) | |
511 | name = h->root.root.string; | |
512 | else | |
513 | { | |
514 | name = _bfd_coff_internal_syment_name (input_bfd, sym, buf); | |
515 | if (name == NULL) | |
516 | return false; | |
517 | } | |
518 | ||
519 | if (! ((*info->callbacks->reloc_overflow) | |
520 | (info, name, howto->name, (bfd_vma) 0, input_bfd, | |
521 | input_section, rel->r_vaddr - input_section->vma))) | |
522 | return false; | |
523 | } | |
524 | } | |
525 | } | |
526 | ||
527 | return true; | |
528 | } | |
529 | ||
530 | /* Adjust the symbol index of any reloc against a global symbol to | |
531 | instead be a reloc against the internal symbol we created specially | |
532 | for the section. */ | |
533 | ||
534 | /*ARGSUSED*/ | |
535 | static boolean | |
536 | coff_i960_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp) | |
537 | bfd *obfd; | |
538 | struct bfd_link_info *info; | |
539 | bfd *ibfd; | |
540 | asection *sec; | |
541 | struct internal_reloc *irel; | |
542 | boolean *adjustedp; | |
543 | { | |
544 | struct coff_link_hash_entry *h; | |
545 | ||
a9713b91 ILT |
546 | *adjustedp = false; |
547 | ||
a208a70f ILT |
548 | h = obj_coff_sym_hashes (ibfd)[irel->r_symndx]; |
549 | if (h == NULL | |
550 | || (h->root.type != bfd_link_hash_defined | |
551 | && h->root.type != bfd_link_hash_defweak)) | |
552 | return true; | |
553 | ||
554 | irel->r_symndx = h->root.u.def.section->output_section->target_index - 1; | |
555 | *adjustedp = true; | |
556 | ||
557 | return true; | |
558 | } | |
559 | ||
560 | #define coff_start_final_link coff_i960_start_final_link | |
561 | ||
562 | #define coff_relocate_section coff_i960_relocate_section | |
563 | ||
564 | #define coff_adjust_symndx coff_i960_adjust_symndx | |
4a81b561 | 565 | |
6812b607 ILT |
566 | #define coff_bfd_reloc_type_lookup coff_i960_reloc_type_lookup |
567 | ||
a208a70f ILT |
568 | #include "coffcode.h" |
569 | ||
ffeef0bb | 570 | const bfd_target icoff_little_vec = |
4a81b561 | 571 | { |
9872a49c | 572 | "coff-Intel-little", /* name */ |
3b4f1a5d | 573 | bfd_target_coff_flavour, |
4a81b561 | 574 | false, /* data byte order is little */ |
9872a49c | 575 | false, /* header byte order is little */ |
4a81b561 DHW |
576 | |
577 | (HAS_RELOC | EXEC_P | /* object flags */ | |
578 | HAS_LINENO | HAS_DEBUG | | |
6812b607 | 579 | HAS_SYMS | HAS_LOCALS | WP_TEXT), |
4a81b561 DHW |
580 | |
581 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ | |
22aabad5 | 582 | '_', /* leading underscore */ |
4a81b561 DHW |
583 | '/', /* ar_pad_char */ |
584 | 15, /* ar_max_namelen */ | |
4a81b561 | 585 | |
6812b607 ILT |
586 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
587 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
588 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
589 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
590 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
591 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ | |
4a81b561 | 592 | |
294eaca4 SC |
593 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ |
594 | bfd_generic_archive_p, _bfd_dummy_target}, | |
595 | {bfd_false, coff_mkobject, /* bfd_set_format */ | |
596 | _bfd_generic_mkarchive, bfd_false}, | |
597 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
598 | _bfd_write_archive_contents, bfd_false}, | |
6812b607 ILT |
599 | |
600 | BFD_JUMP_TABLE_GENERIC (coff), | |
601 | BFD_JUMP_TABLE_COPY (coff), | |
602 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
603 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
604 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
605 | BFD_JUMP_TABLE_RELOCS (coff), | |
606 | BFD_JUMP_TABLE_WRITE (coff), | |
607 | BFD_JUMP_TABLE_LINK (coff), | |
22aabad5 | 608 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
6812b607 | 609 | |
8070f29d | 610 | COFF_SWAP_TABLE, |
8070f29d | 611 | }; |
4a81b561 DHW |
612 | |
613 | ||
ffeef0bb | 614 | const bfd_target icoff_big_vec = |
4a81b561 | 615 | { |
9872a49c | 616 | "coff-Intel-big", /* name */ |
3b4f1a5d | 617 | bfd_target_coff_flavour, |
4a81b561 | 618 | false, /* data byte order is little */ |
9872a49c | 619 | true, /* header byte order is big */ |
4a81b561 DHW |
620 | |
621 | (HAS_RELOC | EXEC_P | /* object flags */ | |
622 | HAS_LINENO | HAS_DEBUG | | |
6812b607 | 623 | HAS_SYMS | HAS_LOCALS | WP_TEXT), |
4a81b561 DHW |
624 | |
625 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */ | |
22aabad5 | 626 | '_', /* leading underscore */ |
4a81b561 DHW |
627 | '/', /* ar_pad_char */ |
628 | 15, /* ar_max_namelen */ | |
4a81b561 | 629 | |
6812b607 ILT |
630 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
631 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
632 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */ | |
633 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, | |
634 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
635 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ | |
4a81b561 | 636 | |
2b1d8a50 JG |
637 | {_bfd_dummy_target, coff_object_p, /* bfd_check_format */ |
638 | bfd_generic_archive_p, _bfd_dummy_target}, | |
639 | {bfd_false, coff_mkobject, /* bfd_set_format */ | |
640 | _bfd_generic_mkarchive, bfd_false}, | |
641 | {bfd_false, coff_write_object_contents, /* bfd_write_contents */ | |
642 | _bfd_write_archive_contents, bfd_false}, | |
6812b607 ILT |
643 | |
644 | BFD_JUMP_TABLE_GENERIC (coff), | |
645 | BFD_JUMP_TABLE_COPY (coff), | |
646 | BFD_JUMP_TABLE_CORE (_bfd_nocore), | |
647 | BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), | |
648 | BFD_JUMP_TABLE_SYMBOLS (coff), | |
649 | BFD_JUMP_TABLE_RELOCS (coff), | |
650 | BFD_JUMP_TABLE_WRITE (coff), | |
651 | BFD_JUMP_TABLE_LINK (coff), | |
22aabad5 | 652 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
6812b607 | 653 | |
8070f29d | 654 | COFF_SWAP_TABLE, |
fc723380 | 655 | }; |