reinstate uin_reloc_p
[deliverable/binutils-gdb.git] / bfd / coff-mcore.c
1 /* BFD back-end for Motorolla MCore COFF/PE
2 Copyright 1999
3 Free Software Foundation, Inc.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
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
18 along with this program; if not, write to the Free Software
19 Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
25 #include "coff/mcore.h"
26 #include "coff/internal.h"
27 #include "coff/pe.h"
28 #include "libcoff.h"
29
30 #ifdef BADMAG
31 #undef BADMAG
32 #endif
33 #define BADMAG(x) MCOREBADMAG(x)
34
35 #ifndef NUM_ELEM
36 #define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0])
37 #endif
38
39 /* This file is compiled more than once, but we only compile the
40 final_link routine once. */
41 extern boolean mcore_bfd_coff_final_link
42 PARAMS ((bfd *, struct bfd_link_info *));
43
44 static struct bfd_link_hash_table * coff_mcore_link_hash_table_create
45 PARAMS ((bfd *));
46 static bfd_reloc_status_type mcore_coff_unsupported_reloc
47 PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
48 static boolean coff_mcore_relocate_section
49 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
50 struct internal_reloc *, struct internal_syment *, asection **));
51 static reloc_howto_type * mcore_coff_reloc_type_lookup
52 PARAMS ((bfd *, bfd_reloc_code_real_type));
53 static reloc_howto_type * coff_mcore_rtype_to_howto
54 PARAMS ((bfd *, asection *, struct internal_reloc *,
55 struct coff_link_hash_entry *, struct internal_syment *, bfd_vma *));
56 static const bfd_target * pe_object_p
57 PARAMS ((bfd *));
58
59
60 \f
61 /* The NT loader points the toc register to &toc + 32768, in order to
62 use the complete range of a 16-bit displacement. We have to adjust
63 for this when we fix up loads displaced off the toc reg. */
64 #define TOC_LOAD_ADJUSTMENT (-32768)
65 #define TOC_SECTION_NAME ".private.toc"
66
67 /* The main body of code is in coffcode.h. */
68 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
69
70 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
71 from smaller values. Start with zero, widen, *then* decrement. */
72 #define MINUS_ONE (((bfd_vma)0) - 1)
73
74 \f
75 static reloc_howto_type mcore_coff_howto_table[] =
76 {
77 /* Unused: */
78 HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
79 0, /* rightshift */
80 0, /* size (0 = byte, 1 = short, 2 = long) */
81 0, /* bitsize */
82 false, /* pc_relative */
83 0, /* bitpos */
84 complain_overflow_dont, /* dont complain_on_overflow */
85 NULL, /* special_function */
86 "ABSOLUTE", /* name */
87 false, /* partial_inplace */
88 0x00, /* src_mask */
89 0x00, /* dst_mask */
90 false), /* pcrel_offset */
91
92 HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */
93 0, /* rightshift */
94 2, /* size (0 = byte, 1 = short, 2 = long) */
95 32, /* bitsize */
96 false, /* pc_relative */
97 0, /* bitpos */
98 complain_overflow_bitfield, /* complain_on_overflow */
99 NULL, /* special_function */
100 "ADDR32", /* name */
101 true, /* partial_inplace */
102 0xffffffff, /* src_mask */
103 0xffffffff, /* dst_mask */
104 false), /* pcrel_offset */
105
106 /* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
107 Should not appear in object files. */
108 HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4, /* type */
109 2, /* rightshift */
110 1, /* size (0 = byte, 1 = short, 2 = long) */
111 8, /* bitsize */
112 true, /* pc_relative */
113 0, /* bitpos */
114 complain_overflow_bitfield, /* complain_on_overflow */
115 mcore_coff_unsupported_reloc, /* special_function */
116 "IMM8BY4", /* name */
117 false, /* partial_inplace */
118 0, /* src_mask */
119 0, /* dst_mask */
120 true), /* pcrel_offset */
121
122 /* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
123 Span 2k instructions == 4k bytes.
124 Only useful pieces at the relocated address are the opcode (5 bits) */
125 HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */
126 1, /* rightshift */
127 1, /* size (0 = byte, 1 = short, 2 = long) */
128 11, /* bitsize */
129 true, /* pc_relative */
130 0, /* bitpos */
131 complain_overflow_signed, /* complain_on_overflow */
132 NULL, /* special_function */
133 "IMM11BY2", /* name */
134 false, /* partial_inplace */
135 0x0, /* src_mask */
136 0x7ff, /* dst_mask */
137 true), /* pcrel_offset */
138
139 /* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
140 HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2, /* type */
141 1, /* rightshift */
142 1, /* size (0 = byte, 1 = short, 2 = long) */
143 4, /* bitsize */
144 true, /* pc_relative */
145 0, /* bitpos */
146 complain_overflow_bitfield, /* complain_on_overflow */
147 mcore_coff_unsupported_reloc, /* special_function */
148 "IMM4BY2", /* name */
149 false, /* partial_inplace */
150 0, /* src_mask */
151 0, /* dst_mask */
152 true), /* pcrel_offset */
153
154 /* 32-bit pc-relative. Eventually this will help support PIC code. */
155 HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */
156 0, /* rightshift */
157 2, /* size (0 = byte, 1 = short, 2 = long) */
158 32, /* bitsize */
159 true, /* pc_relative */
160 0, /* bitpos */
161 complain_overflow_bitfield, /* complain_on_overflow */
162 NULL, /* special_function */
163 "PCREL_32", /* name */
164 false, /* partial_inplace */
165 0x0, /* src_mask */
166 0xffffffff, /* dst_mask */
167 true), /* pcrel_offset */
168
169 /* Like PCREL_IMM11BY2, this relocation indicates that there is a
170 'jsri' at the specified address. There is a separate relocation
171 entry for the literal pool entry that it references, but we
172 might be able to change the jsri to a bsr if the target turns out
173 to be close enough [even though we won't reclaim the literal pool
174 entry, we'll get some runtime efficiency back]. Note that this
175 is a relocation that we are allowed to safely ignore. */
176 HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */
177 1, /* rightshift */
178 1, /* size (0 = byte, 1 = short, 2 = long) */
179 11, /* bitsize */
180 true, /* pc_relative */
181 0, /* bitpos */
182 complain_overflow_signed, /* complain_on_overflow */
183 NULL, /* special_function */
184 "JSR_IMM11BY2", /* name */
185 false, /* partial_inplace */
186 0x0, /* src_mask */
187 0x7ff, /* dst_mask */
188 true), /* pcrel_offset */
189
190 HOWTO (IMAGE_REL_MCORE_RVA, /* type */
191 0, /* rightshift */
192 2, /* size (0 = byte, 1 = short, 2 = long) */
193 32, /* bitsize */
194 false, /* pc_relative */
195 0, /* bitpos */
196 complain_overflow_signed, /* complain_on_overflow */
197 NULL, /* special_function */
198 "MCORE_RVA", /* name */
199 true, /* partial_inplace */
200 0xffffffff, /* src_mask */
201 0xffffffff, /* dst_mask */
202 true) /* pcrel_offset */
203 };
204 \f
205 /* Extend the coff_link_hash_table structure with a few M*Core specific fields.
206 This allows us to store global data here without actually creating any
207 global variables, which is a no-no in the BFD world. */
208 typedef struct coff_mcore_link_hash_table
209 {
210 /* The original coff_link_hash_table structure. MUST be first field. */
211 struct coff_link_hash_table root;
212
213 bfd * bfd_of_toc_owner;
214 long int global_toc_size;
215 long int import_table_size;
216 long int first_thunk_address;
217 long int thunk_size;
218 }
219 mcore_hash_table;
220
221 /* Get the MCore coff linker hash table from a link_info structure. */
222 #define coff_mcore_hash_table(info) \
223 ((mcore_hash_table *) ((info)->hash))
224
225 /* Create an MCore coff linker hash table. */
226 static struct bfd_link_hash_table *
227 coff_mcore_link_hash_table_create (abfd)
228 bfd * abfd;
229 {
230 mcore_hash_table * ret;
231
232 ret = ((mcore_hash_table *) bfd_alloc (abfd, sizeof (* ret)));
233 if (ret == (mcore_hash_table *) NULL)
234 return NULL;
235
236 if (! _bfd_coff_link_hash_table_init
237 (& ret->root, abfd, _bfd_coff_link_hash_newfunc))
238 {
239 bfd_release (abfd, ret);
240 return (struct bfd_link_hash_table *) NULL;
241 }
242
243 ret->bfd_of_toc_owner = NULL;
244 ret->global_toc_size = 0;
245 ret->import_table_size = 0;
246 ret->first_thunk_address = 0;
247 ret->thunk_size = 0;
248
249 return & ret->root.root;
250 }
251 \f
252 /*ARGSUSED*/
253 static bfd_reloc_status_type
254 mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section,
255 output_bfd, error_message)
256 bfd * abfd;
257 arelent * reloc_entry;
258 asymbol * symbol;
259 PTR data;
260 asection * input_section;
261 bfd * output_bfd;
262 char ** error_message;
263 {
264 BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0);
265
266 _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"),
267 bfd_get_filename (abfd),
268 reloc_entry->howto->name,
269 reloc_entry->howto->type);
270
271 return bfd_reloc_notsupported;
272 }
273
274 \f
275 /* A cheesy little macro to make the code a little more readable. */
276 #define HOW2MAP(bfd_rtype, mcore_rtype) \
277 case bfd_rtype: return & mcore_coff_howto_table [mcore_rtype]
278
279 static reloc_howto_type *
280 mcore_coff_reloc_type_lookup (abfd, code)
281 bfd * abfd;
282 bfd_reloc_code_real_type code;
283 {
284 switch (code)
285 {
286 HOW2MAP (BFD_RELOC_32, IMAGE_REL_MCORE_ADDR32);
287 HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM8BY4, IMAGE_REL_MCORE_PCREL_IMM8BY4);
288 HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM11BY2, IMAGE_REL_MCORE_PCREL_IMM11BY2);
289 HOW2MAP (BFD_RELOC_MCORE_PCREL_IMM4BY2, IMAGE_REL_MCORE_PCREL_IMM4BY2);
290 HOW2MAP (BFD_RELOC_32_PCREL, IMAGE_REL_MCORE_PCREL_32);
291 HOW2MAP (BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2);
292 HOW2MAP (BFD_RELOC_RVA, IMAGE_REL_MCORE_RVA);
293 default:
294 return NULL;
295 }
296 /*NOTREACHED*/
297 }
298
299 #undef HOW2MAP
300
301 #define RTYPE2HOWTO(cache_ptr, dst) \
302 (cache_ptr)->howto = mcore_coff_howto_table + (dst)->r_type;
303
304 static reloc_howto_type *
305 coff_mcore_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
306 bfd * abfd;
307 asection * sec;
308 struct internal_reloc * rel;
309 struct coff_link_hash_entry * h;
310 struct internal_syment * sym;
311 bfd_vma * addendp;
312 {
313 reloc_howto_type * howto;
314
315
316 if (rel->r_type >= NUM_ELEM (mcore_coff_howto_table))
317 return NULL;
318
319 howto = mcore_coff_howto_table + rel->r_type;
320
321 if (rel->r_type == IMAGE_REL_MCORE_RVA)
322 * addendp -= pe_data (sec->output_section->owner)->pe_opthdr.ImageBase;
323
324 if (howto->pc_relative)
325 {
326 * addendp = sec->vma - 2; /* XXX guess - is this right ? */
327
328 /* If the symbol is defined, then the generic code is going to
329 add back the symbol value in order to cancel out an
330 adjustment it made to the addend. However, we set the addend
331 to 0 at the start of this function. We need to adjust here,
332 to avoid the adjustment the generic code will make. FIXME:
333 This is getting a bit hackish. */
334 if (sym != NULL && sym->n_scnum != 0)
335 * addendp -= sym->n_value;
336 }
337 else
338 * addendp = 0;
339
340 return howto;
341 }
342
343 /* Return true if this relocation should appear in the output .reloc section.
344 This function is referenced in pe_mkobject in peicode.h. */
345 static boolean
346 in_reloc_p (abfd, howto)
347 bfd * abfd;
348 reloc_howto_type * howto;
349 {
350 return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA;
351 }
352
353 \f
354 /* The reloc processing routine for the optimized COFF linker. */
355 static boolean
356 coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
357 contents, relocs, syms, sections)
358 bfd * output_bfd;
359 struct bfd_link_info * info;
360 bfd * input_bfd;
361 asection * input_section;
362 bfd_byte * contents;
363 struct internal_reloc * relocs;
364 struct internal_syment * syms;
365 asection ** sections;
366 {
367 struct internal_reloc * rel;
368 struct internal_reloc * relend;
369 boolean hihalf;
370 bfd_vma hihalf_val;
371
372 /* If we are performing a relocateable link, we don't need to do a
373 thing. The caller will take care of adjusting the reloc
374 addresses and symbol indices. */
375 if (info->relocateable)
376 return true;
377
378 /* Check if we have the same endianess */
379 if ( input_bfd->xvec->byteorder != output_bfd->xvec->byteorder
380 && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
381 {
382 (*_bfd_error_handler)
383 (_("%s: compiled for a %s endian system and target is %s endian.\n"),
384 bfd_get_filename (input_bfd),
385 bfd_big_endian (input_bfd) ? "big" : "little",
386 bfd_big_endian (output_bfd) ? "big" : "little");
387
388 bfd_set_error (bfd_error_wrong_format);
389 return false;
390 }
391
392 hihalf = false;
393 hihalf_val = 0;
394
395 rel = relocs;
396 relend = rel + input_section->reloc_count;
397
398 for (; rel < relend; rel++)
399 {
400 asection * toc_section = NULL;
401 bfd_vma relocation;
402 long symndx;
403 struct internal_syment * sym;
404 bfd_vma val;
405 bfd_vma addend;
406 bfd_reloc_status_type rstat;
407 bfd_byte * loc;
408 unsigned short r_type = rel->r_type;
409 reloc_howto_type * howto = NULL;
410 struct coff_link_hash_entry * h;
411 const char * my_name;
412
413 symndx = rel->r_symndx;
414 loc = contents + rel->r_vaddr - input_section->vma;
415
416 if (symndx == -1)
417 {
418 h = NULL;
419 sym = NULL;
420 }
421 else
422 {
423 h = obj_coff_sym_hashes (input_bfd)[symndx];
424 sym = syms + symndx;
425 }
426
427 /* Get the howto and initialise the addend. */
428 howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
429 sym, & addend);
430 if (howto == NULL)
431 return false;
432
433 val = 0;
434
435 if (h == NULL)
436 {
437 if (symndx == -1)
438 my_name = "*ABS*";
439 else
440 {
441 asection * sec = sections[symndx];
442
443 val = (sym->n_value
444 + sec->output_section->vma
445 + sec->output_offset);
446
447 if (sym == NULL)
448 my_name = "*unknown*";
449 else if ( sym->_n._n_n._n_zeroes == 0
450 && sym->_n._n_n._n_offset != 0)
451 my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
452 else
453 {
454 static char buf [SYMNMLEN + 1];
455
456 strncpy (buf, sym->_n._n_name, SYMNMLEN);
457 buf[SYMNMLEN] = '\0';
458 my_name = buf;
459 }
460 }
461 }
462 else
463 {
464 if ( h->root.type == bfd_link_hash_defined
465 || h->root.type == bfd_link_hash_defweak)
466 {
467 asection * sec = h->root.u.def.section;
468
469 val = (h->root.u.def.value
470 + sec->output_section->vma
471 + sec->output_offset);
472 }
473 else
474 {
475 if (! ((*info->callbacks->undefined_symbol)
476 (info, h->root.root.string, input_bfd, input_section,
477 rel->r_vaddr - input_section->vma)))
478 return false;
479 }
480
481 my_name = h->root.root.string;
482 }
483
484 rstat = bfd_reloc_ok;
485
486 /* Each case must do its own relocation, setting rstat appropriately. */
487 switch (r_type)
488 {
489 default:
490 _bfd_error_handler (_("%s: unsupported relocation type 0x%02x"),
491 bfd_get_filename (input_bfd), r_type);
492 bfd_set_error (bfd_error_bad_value);
493 return false;
494
495 case IMAGE_REL_MCORE_ABSOLUTE:
496 fprintf (stderr,
497 _("Warning: unsupported reloc %s <file %s, section %s>\n"),
498 howto->name,
499 bfd_get_filename (input_bfd),
500 input_section->name);
501
502 fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n",
503 rel->r_symndx, my_name, (long) rel->r_vaddr,
504 (unsigned long) rel->r_vaddr);
505 break;
506
507 case IMAGE_REL_MCORE_PCREL_IMM8BY4:
508 case IMAGE_REL_MCORE_PCREL_IMM11BY2:
509 case IMAGE_REL_MCORE_PCREL_IMM4BY2:
510 case IMAGE_REL_MCORE_PCREL_32:
511 case IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2:
512 case IMAGE_REL_MCORE_ADDR32:
513 case IMAGE_REL_MCORE_RVA:
514 rstat = _bfd_relocate_contents (howto, input_bfd, val, loc);
515 break;
516 }
517
518 switch (rstat)
519 {
520 default:
521 abort ();
522
523 case bfd_reloc_ok:
524 break;
525
526 case bfd_reloc_overflow:
527 if (! ((*info->callbacks->reloc_overflow)
528 (info, my_name, howto->name,
529 (bfd_vma) 0, input_bfd,
530 input_section, rel->r_vaddr - input_section->vma)))
531 return false;
532 }
533 }
534
535 return true;
536 }
537
538 \f
539 /* Tailor coffcode.h -- macro heaven. */
540
541 /* We use the special COFF backend linker, with our own special touch. */
542
543 #define coff_bfd_reloc_type_lookup mcore_coff_reloc_type_lookup
544 #define coff_relocate_section coff_mcore_relocate_section
545 #define coff_rtype_to_howto coff_mcore_rtype_to_howto
546
547 #define SELECT_RELOC(internal, howto) {internal.r_type = howto->type;}
548
549 #define COFF_PAGE_SIZE 0x1000
550
551 #include "coffcode.h"
552 \f
553 static const bfd_target *
554 pe_object_p (abfd)
555 bfd * abfd;
556 {
557 #ifdef COFF_IMAGE_WITH_PE
558 /* We need to hack badly to handle a PE image correctly. In PE
559 images created by the GNU linker, the offset to the COFF header
560 is always the size. However, this is not the case in images
561 generated by other PE linkers. The PE format stores a four byte
562 offset to the PE signature just before the COFF header at
563 location 0x3c of the file. We pick up that offset, verify that
564 the PE signature is there, and then set ourselves up to read in
565 the COFF header. */
566 {
567 bfd_byte ext_offset[4];
568 file_ptr offset;
569 bfd_byte ext_signature[4];
570 unsigned long signature;
571
572 if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
573 || bfd_read (ext_offset, 1, 4, abfd) != 4)
574 {
575 if (bfd_get_error () != bfd_error_system_call)
576 bfd_set_error (bfd_error_wrong_format);
577 return NULL;
578 }
579
580 offset = bfd_h_get_32 (abfd, ext_offset);
581
582 if (bfd_seek (abfd, offset, SEEK_SET) != 0
583 || bfd_read (ext_signature, 1, 4, abfd) != 4)
584 {
585 if (bfd_get_error () != bfd_error_system_call)
586 bfd_set_error (bfd_error_wrong_format);
587
588 return NULL;
589 }
590
591 signature = bfd_h_get_32 (abfd, ext_signature);
592
593 if (signature != 0x4550)
594 {
595 bfd_set_error (bfd_error_wrong_format);
596 return NULL;
597 }
598
599 /* Here is the hack. coff_object_p wants to read filhsz bytes to
600 pick up the COFF header. We adjust so that that will work. 20
601 is the size of the mips COFF filehdr. */
602 if (bfd_seek (abfd, (bfd_tell (abfd) - bfd_coff_filhsz (abfd) + 20),
603 SEEK_SET) != 0)
604 {
605 if (bfd_get_error () != bfd_error_system_call)
606 bfd_set_error (bfd_error_wrong_format);
607
608 return NULL;
609 }
610 }
611 #endif
612
613 return coff_object_p (abfd);
614 }
615 \f
616 /* The transfer vectors that lead the outside world to all of the above. */
617
618 const bfd_target
619 TARGET_BIG_SYM =
620 {
621 TARGET_BIG_NAME,
622 bfd_target_coff_flavour,
623 BFD_ENDIAN_BIG, /* data byte order is big */
624 BFD_ENDIAN_BIG, /* header byte order is big */
625
626 (HAS_RELOC | EXEC_P | /* object flags */
627 HAS_LINENO | HAS_DEBUG |
628 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
629
630 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
631 | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
632
633 0, /* leading char */
634 '/', /* ar_pad_char */
635 15, /* ar_max_namelen */
636
637 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
638 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
639 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
640
641 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
642 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
643 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
644
645 { _bfd_dummy_target,
646 pe_object_p, /* bfd_check_format */
647 bfd_generic_archive_p, /* _bfd_dummy_target */
648 pe_object_p
649 },
650 { bfd_false,
651 coff_mkobject,
652 _bfd_generic_mkarchive, /* bfd_set_format */
653 bfd_false
654 },
655 { bfd_false,
656 coff_write_object_contents, /* bfd_write_contents */
657 _bfd_write_archive_contents,
658 bfd_false
659 },
660
661 BFD_JUMP_TABLE_GENERIC (coff),
662 BFD_JUMP_TABLE_COPY (coff),
663 BFD_JUMP_TABLE_CORE (_bfd_nocore),
664 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
665 BFD_JUMP_TABLE_SYMBOLS (coff),
666 BFD_JUMP_TABLE_RELOCS (coff),
667 BFD_JUMP_TABLE_WRITE (coff),
668 BFD_JUMP_TABLE_LINK (coff),
669 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
670
671 COFF_SWAP_TABLE,
672 };
673
674 const bfd_target
675 TARGET_LITTLE_SYM =
676 {
677 TARGET_LITTLE_NAME,
678 bfd_target_coff_flavour,
679 BFD_ENDIAN_LITTLE, /* data byte order is little */
680 BFD_ENDIAN_LITTLE, /* header byte order is little */
681
682 (HAS_RELOC | EXEC_P | /* object flags */
683 HAS_LINENO | HAS_DEBUG |
684 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
685
686 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
687 | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
688
689 0, /* leading underscore */
690 '/', /* ar_pad_char */
691 15, /* ar_max_namelen */
692
693 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
694 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
695 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
696
697 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
698 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
699 bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
700
701 /* Note that we allow an object file to be treated as a core file as well. */
702 {
703 _bfd_dummy_target,
704 pe_object_p, /* bfd_check_format */
705 bfd_generic_archive_p,
706 pe_object_p
707 },
708 {
709 bfd_false,
710 coff_mkobject,
711 _bfd_generic_mkarchive, /* bfd_set_format */
712 bfd_false
713 },
714 {
715 bfd_false,
716 coff_write_object_contents, /* bfd_write_contents */
717 _bfd_write_archive_contents,
718 bfd_false
719 },
720
721 BFD_JUMP_TABLE_GENERIC (coff),
722 BFD_JUMP_TABLE_COPY (coff),
723 BFD_JUMP_TABLE_CORE (_bfd_nocore),
724 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
725 BFD_JUMP_TABLE_SYMBOLS (coff),
726 BFD_JUMP_TABLE_RELOCS (coff),
727 BFD_JUMP_TABLE_WRITE (coff),
728 BFD_JUMP_TABLE_LINK (coff),
729 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
730
731 COFF_SWAP_TABLE,
732 };
733
This page took 0.065924 seconds and 5 git commands to generate.