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