1999-08-18 Donn Terry <donn@interix.com>
[external/binutils.git] / bfd / coff-i386.c
1 /* BFD back-end for Intel 386 COFF files.
2    Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
3    Free Software Foundation, Inc.
4    Written by Cygnus Support.
5
6 This file is part of BFD, the Binary File Descriptor library.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
21
22 #include "bfd.h"
23 #include "sysdep.h"
24 #include "libbfd.h"
25
26 #include "coff/i386.h"
27
28 #include "coff/internal.h"
29
30 #ifdef COFF_WITH_PE
31 #include "coff/pe.h"
32 #endif
33
34 #ifdef COFF_GO32_EXE
35 #include "coff/go32exe.h"
36 #endif
37
38 #include "libcoff.h"
39
40 static bfd_reloc_status_type coff_i386_reloc 
41   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
42 static reloc_howto_type *coff_i386_rtype_to_howto
43   PARAMS ((bfd *, asection *, struct internal_reloc *,
44            struct coff_link_hash_entry *, struct internal_syment *,
45            bfd_vma *));
46 static reloc_howto_type *coff_i386_reloc_type_lookup
47   PARAMS ((bfd *, bfd_reloc_code_real_type));
48 static const bfd_target *i3coff_object_p PARAMS ((bfd *));
49
50 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
51 /* The page size is a guess based on ELF.  */
52
53 #define COFF_PAGE_SIZE 0x1000
54
55 /* For some reason when using i386 COFF the value stored in the .text
56    section for a reference to a common symbol is the value itself plus
57    any desired offset.  Ian Taylor, Cygnus Support.  */
58
59 /* If we are producing relocateable output, we need to do some
60    adjustments to the object file that are not done by the
61    bfd_perform_relocation function.  This function is called by every
62    reloc type to make any required adjustments.  */
63
64 static bfd_reloc_status_type
65 coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
66                  error_message)
67      bfd *abfd;
68      arelent *reloc_entry;
69      asymbol *symbol;
70      PTR data;
71      asection *input_section ATTRIBUTE_UNUSED;
72      bfd *output_bfd;
73      char **error_message ATTRIBUTE_UNUSED;
74 {
75   symvalue diff;
76
77   if (output_bfd == (bfd *) NULL)
78     return bfd_reloc_continue;
79
80   if (bfd_is_com_section (symbol->section))
81     {
82 #ifndef COFF_WITH_PE
83       /* We are relocating a common symbol.  The current value in the
84          object file is ORIG + OFFSET, where ORIG is the value of the
85          common symbol as seen by the object file when it was compiled
86          (this may be zero if the symbol was undefined) and OFFSET is
87          the offset into the common symbol (normally zero, but may be
88          non-zero when referring to a field in a common structure).
89          ORIG is the negative of reloc_entry->addend, which is set by
90          the CALC_ADDEND macro below.  We want to replace the value in
91          the object file with NEW + OFFSET, where NEW is the value of
92          the common symbol which we are going to put in the final
93          object file.  NEW is symbol->value.  */
94       diff = symbol->value + reloc_entry->addend;
95 #else
96       /* In PE mode, we do not offset the common symbol.  */
97       diff = reloc_entry->addend;
98 #endif
99     }
100   else
101     {
102       /* For some reason bfd_perform_relocation always effectively
103          ignores the addend for a COFF target when producing
104          relocateable output.  This seems to be always wrong for 386
105          COFF, so we handle the addend here instead.  */
106       diff = reloc_entry->addend;
107     }
108
109 #ifdef COFF_WITH_PE
110   /* FIXME: How should this case be handled?  */
111   if (reloc_entry->howto->type == R_IMAGEBASE)
112     diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
113 #endif
114
115 #define DOIT(x) \
116   x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
117
118     if (diff != 0)
119       {
120         reloc_howto_type *howto = reloc_entry->howto;
121         unsigned char *addr = (unsigned char *) data + reloc_entry->address;
122
123         switch (howto->size)
124           {
125           case 0:
126             {
127               char x = bfd_get_8 (abfd, addr);
128               DOIT (x);
129               bfd_put_8 (abfd, x, addr);
130             }
131             break;
132
133           case 1:
134             {
135               short x = bfd_get_16 (abfd, addr);
136               DOIT (x);
137               bfd_put_16 (abfd, x, addr);
138             }
139             break;
140
141           case 2:
142             {
143               long x = bfd_get_32 (abfd, addr);
144               DOIT (x);
145               bfd_put_32 (abfd, x, addr);
146             }
147             break;
148
149           default:
150             abort ();
151           }
152       }
153
154   /* Now let bfd_perform_relocation finish everything up.  */
155   return bfd_reloc_continue;
156 }
157
158 #ifdef COFF_WITH_PE
159 /* Return true if this relocation should
160    appear in the output .reloc section. */
161
162 static boolean in_reloc_p(abfd, howto)
163      bfd * abfd ATTRIBUTE_UNUSED;
164      reloc_howto_type *howto;
165 {
166   return ! howto->pc_relative && howto->type != R_IMAGEBASE;
167 }     
168 #endif
169
170 #ifndef PCRELOFFSET
171 #define PCRELOFFSET false
172 #endif
173
174 static reloc_howto_type howto_table[] = 
175 {
176   EMPTY_HOWTO (0),
177   EMPTY_HOWTO (1),
178   EMPTY_HOWTO (2),
179   EMPTY_HOWTO (3),
180   EMPTY_HOWTO (4),
181   EMPTY_HOWTO (5),
182   HOWTO (R_DIR32,               /* type */                                 
183          0,                     /* rightshift */                           
184          2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
185          32,                    /* bitsize */                   
186          false,                 /* pc_relative */                          
187          0,                     /* bitpos */                               
188          complain_overflow_bitfield, /* complain_on_overflow */
189          coff_i386_reloc,       /* special_function */                     
190          "dir32",               /* name */                                 
191          true,                  /* partial_inplace */                      
192          0xffffffff,            /* src_mask */                             
193          0xffffffff,            /* dst_mask */                             
194          true),                /* pcrel_offset */
195   /* PE IMAGE_REL_I386_DIR32NB relocation (7).  */
196   HOWTO (R_IMAGEBASE,            /* type */                                 
197          0,                     /* rightshift */                           
198          2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
199          32,                    /* bitsize */                   
200          false,                 /* pc_relative */                          
201          0,                     /* bitpos */                               
202          complain_overflow_bitfield, /* complain_on_overflow */
203          coff_i386_reloc,       /* special_function */                     
204          "rva32",                  /* name */                                 
205          true,                  /* partial_inplace */                      
206          0xffffffff,            /* src_mask */                             
207          0xffffffff,            /* dst_mask */                             
208          false),                /* pcrel_offset */
209   EMPTY_HOWTO (010),
210   EMPTY_HOWTO (011),
211   EMPTY_HOWTO (012),
212   EMPTY_HOWTO (013),
213   EMPTY_HOWTO (014),
214   EMPTY_HOWTO (015),
215   EMPTY_HOWTO (016),
216   /* Byte relocation (017).  */
217   HOWTO (R_RELBYTE,             /* type */
218          0,                     /* rightshift */                           
219          0,                     /* size (0 = byte, 1 = short, 2 = long) */ 
220          8,                     /* bitsize */                   
221          false,                 /* pc_relative */                          
222          0,                     /* bitpos */                               
223          complain_overflow_bitfield, /* complain_on_overflow */
224          coff_i386_reloc,       /* special_function */                     
225          "8",                   /* name */                                 
226          true,                  /* partial_inplace */                      
227          0x000000ff,            /* src_mask */                             
228          0x000000ff,            /* dst_mask */                             
229          PCRELOFFSET),          /* pcrel_offset */
230   /* 16-bit word relocation (020).  */
231   HOWTO (R_RELWORD,             /* type */                                 
232          0,                     /* rightshift */                           
233          1,                     /* size (0 = byte, 1 = short, 2 = long) */ 
234          16,                    /* bitsize */                   
235          false,                 /* pc_relative */                          
236          0,                     /* bitpos */                               
237          complain_overflow_bitfield, /* complain_on_overflow */
238          coff_i386_reloc,       /* special_function */                     
239          "16",                  /* name */                                 
240          true,                  /* partial_inplace */                      
241          0x0000ffff,            /* src_mask */                             
242          0x0000ffff,            /* dst_mask */                             
243          PCRELOFFSET),          /* pcrel_offset */
244   /* 32-bit longword relocation (021).  */
245   HOWTO (R_RELLONG,             /* type */                                 
246          0,                     /* rightshift */                           
247          2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
248          32,                    /* bitsize */                   
249          false,                 /* pc_relative */                          
250          0,                     /* bitpos */                               
251          complain_overflow_bitfield, /* complain_on_overflow */
252          coff_i386_reloc,       /* special_function */                     
253          "32",                  /* name */                                 
254          true,                  /* partial_inplace */                      
255          0xffffffff,            /* src_mask */                             
256          0xffffffff,            /* dst_mask */                             
257          PCRELOFFSET),          /* pcrel_offset */
258   /* Byte PC relative relocation (022).  */
259   HOWTO (R_PCRBYTE,             /* type */                                 
260          0,                     /* rightshift */                           
261          0,                     /* size (0 = byte, 1 = short, 2 = long) */ 
262          8,                     /* bitsize */                   
263          true,                  /* pc_relative */                          
264          0,                     /* bitpos */                               
265          complain_overflow_signed, /* complain_on_overflow */
266          coff_i386_reloc,       /* special_function */                     
267          "DISP8",               /* name */                                 
268          true,                  /* partial_inplace */                      
269          0x000000ff,            /* src_mask */                             
270          0x000000ff,            /* dst_mask */                             
271          PCRELOFFSET),          /* pcrel_offset */
272   /* 16-bit word PC relative relocation (023).  */
273   HOWTO (R_PCRWORD,             /* type */                                 
274          0,                     /* rightshift */                           
275          1,                     /* size (0 = byte, 1 = short, 2 = long) */ 
276          16,                    /* bitsize */                   
277          true,                  /* pc_relative */                          
278          0,                     /* bitpos */                               
279          complain_overflow_signed, /* complain_on_overflow */
280          coff_i386_reloc,       /* special_function */                     
281          "DISP16",              /* name */                                 
282          true,                  /* partial_inplace */                      
283          0x0000ffff,            /* src_mask */                             
284          0x0000ffff,            /* dst_mask */                             
285          PCRELOFFSET),          /* pcrel_offset */
286   /* 32-bit longword PC relative relocation (024).  */
287   HOWTO (R_PCRLONG,             /* type */                                 
288          0,                     /* rightshift */                           
289          2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
290          32,                    /* bitsize */                   
291          true,                  /* pc_relative */                          
292          0,                     /* bitpos */                               
293          complain_overflow_signed, /* complain_on_overflow */
294          coff_i386_reloc,       /* special_function */                     
295          "DISP32",              /* name */                                 
296          true,                  /* partial_inplace */                      
297          0xffffffff,            /* src_mask */                             
298          0xffffffff,            /* dst_mask */                             
299          PCRELOFFSET)           /* pcrel_offset */
300 };
301
302 /* Turn a howto into a reloc  nunmber */
303
304 #define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
305 #define BADMAG(x) I386BADMAG(x)
306 #define I386 1                  /* Customize coffcode.h */
307
308 #define RTYPE2HOWTO(cache_ptr, dst)                                     \
309   ((cache_ptr)->howto =                                                 \
310    ((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0])      \
311     ? howto_table + (dst)->r_type                                       \
312     : NULL))
313
314 /* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
315    library.  On some other COFF targets STYP_BSS is normally
316    STYP_NOLOAD.  */
317 #define BSS_NOLOAD_IS_SHARED_LIBRARY
318
319 /* Compute the addend of a reloc.  If the reloc is to a common symbol,
320    the object file contains the value of the common symbol.  By the
321    time this is called, the linker may be using a different symbol
322    from a different object file with a different value.  Therefore, we
323    hack wildly to locate the original symbol from this file so that we
324    can make the correct adjustment.  This macro sets coffsym to the
325    symbol from the original file, and uses it to set the addend value
326    correctly.  If this is not a common symbol, the usual addend
327    calculation is done, except that an additional tweak is needed for
328    PC relative relocs.
329    FIXME: This macro refers to symbols and asect; these are from the
330    calling function, not the macro arguments.  */
331
332 #define CALC_ADDEND(abfd, ptr, reloc, cache_ptr)                \
333   {                                                             \
334     coff_symbol_type *coffsym = (coff_symbol_type *) NULL;      \
335     if (ptr && bfd_asymbol_bfd (ptr) != abfd)                   \
336       coffsym = (obj_symbols (abfd)                             \
337                  + (cache_ptr->sym_ptr_ptr - symbols));         \
338     else if (ptr)                                               \
339       coffsym = coff_symbol_from (abfd, ptr);                   \
340     if (coffsym != (coff_symbol_type *) NULL                    \
341         && coffsym->native->u.syment.n_scnum == 0)              \
342       cache_ptr->addend = - coffsym->native->u.syment.n_value;  \
343     else if (ptr && bfd_asymbol_bfd (ptr) == abfd               \
344              && ptr->section != (asection *) NULL)              \
345       cache_ptr->addend = - (ptr->section->vma + ptr->value);   \
346     else                                                        \
347       cache_ptr->addend = 0;                                    \
348     if (ptr && howto_table[reloc.r_type].pc_relative)           \
349       cache_ptr->addend += asect->vma;                          \
350   }
351
352 /* We use the special COFF backend linker.  For normal i386 COFF, we
353    can use the generic relocate_section routine.  For PE, we need our
354    own routine.  */
355
356 #ifndef COFF_WITH_PE
357
358 #define coff_relocate_section _bfd_coff_generic_relocate_section
359
360 #else /* COFF_WITH_PE */
361
362 /* The PE relocate section routine.  The only difference between this
363    and the regular routine is that we don't want to do anything for a
364    relocateable link.  */
365
366 static boolean coff_pe_i386_relocate_section
367   PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
368            struct internal_reloc *, struct internal_syment *, asection **));
369
370 static boolean
371 coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
372                                input_section, contents, relocs, syms,
373                                sections)
374      bfd *output_bfd;
375      struct bfd_link_info *info;
376      bfd *input_bfd;
377      asection *input_section;
378      bfd_byte *contents;
379      struct internal_reloc *relocs;
380      struct internal_syment *syms;
381      asection **sections;
382 {
383   if (info->relocateable)
384     return true;
385
386   return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
387                                              input_section, contents,
388                                              relocs, syms, sections);
389 }
390
391 #define coff_relocate_section coff_pe_i386_relocate_section
392
393 #endif /* COFF_WITH_PE */
394
395 /* Convert an rtype to howto for the COFF backend linker.  */
396
397 static reloc_howto_type *
398 coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
399      bfd *abfd ATTRIBUTE_UNUSED;
400      asection *sec;
401      struct internal_reloc *rel;
402      struct coff_link_hash_entry *h;
403      struct internal_syment *sym;
404      bfd_vma *addendp;
405 {
406   reloc_howto_type *howto;
407
408   if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0]))
409     {
410       bfd_set_error (bfd_error_bad_value);
411       return NULL;
412     }
413
414   howto = howto_table + rel->r_type;
415
416 #ifdef COFF_WITH_PE
417   /* Cancel out code in _bfd_coff_generic_relocate_section.  */
418   *addendp = 0;
419 #endif
420
421   if (howto->pc_relative)
422     *addendp += sec->vma;
423
424   if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
425     {
426       /* This is a common symbol.  The section contents include the
427          size (sym->n_value) as an addend.  The relocate_section
428          function will be adding in the final value of the symbol.  We
429          need to subtract out the current size in order to get the
430          correct result.  */
431  
432       BFD_ASSERT (h != NULL);
433
434 #ifndef COFF_WITH_PE
435       /* I think we *do* want to bypass this.  If we don't, I have
436          seen some data parameters get the wrong relocation address.
437          If I link two versions with and without this section bypassed
438          and then do a binary comparison, the addresses which are
439          different can be looked up in the map.  The case in which
440          this section has been bypassed has addresses which correspond
441          to values I can find in the map.  */
442       *addendp -= sym->n_value;
443 #endif
444     }
445
446 #ifndef COFF_WITH_PE
447   /* If the output symbol is common (in which case this must be a
448      relocateable link), we need to add in the final size of the
449      common symbol.  */
450   if (h != NULL && h->root.type == bfd_link_hash_common) 
451     *addendp += h->root.u.c.size;
452 #endif
453
454 #ifdef COFF_WITH_PE
455   if (howto->pc_relative)
456     {
457       *addendp -= 4;
458
459       /* If the symbol is defined, then the generic code is going to
460          add back the symbol value in order to cancel out an
461          adjustment it made to the addend.  However, we set the addend
462          to 0 at the start of this function.  We need to adjust here,
463          to avoid the adjustment the generic code will make.  FIXME:
464          This is getting a bit hackish.  */
465       if (sym != NULL && sym->n_scnum != 0)
466         *addendp -= sym->n_value;
467     }
468
469   if (rel->r_type == R_IMAGEBASE)
470     {
471       *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
472     }
473 #endif
474
475   return howto;
476 }
477
478 #define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
479
480 static reloc_howto_type *
481 coff_i386_reloc_type_lookup (abfd, code)
482      bfd *abfd ATTRIBUTE_UNUSED;
483      bfd_reloc_code_real_type code;
484 {
485   switch (code)
486     {
487     case BFD_RELOC_RVA:
488       return howto_table +R_IMAGEBASE;
489     case BFD_RELOC_32:
490       return howto_table + R_DIR32;
491     case BFD_RELOC_32_PCREL:
492       return howto_table + R_PCRLONG;
493     default:
494       BFD_FAIL ();
495       return 0;
496     }
497 }
498
499 #define coff_rtype_to_howto coff_i386_rtype_to_howto
500
501 #ifdef TARGET_UNDERSCORE
502
503 /* If i386 gcc uses underscores for symbol names, then it does not use
504    a leading dot for local labels, so if TARGET_UNDERSCORE is defined
505    we treat all symbols starting with L as local.  */
506
507 static boolean coff_i386_is_local_label_name PARAMS ((bfd *, const char *));
508
509 static boolean
510 coff_i386_is_local_label_name (abfd, name)
511      bfd *abfd;
512      const char *name;
513 {
514   if (name[0] == 'L')
515     return true;
516
517   return _bfd_coff_is_local_label_name (abfd, name);
518 }
519
520 #define coff_bfd_is_local_label_name coff_i386_is_local_label_name
521
522 #endif /* TARGET_UNDERSCORE */
523
524 #include "coffcode.h"
525
526 static const bfd_target *
527 i3coff_object_p (abfd)
528      bfd *abfd;
529 {
530 #ifdef COFF_IMAGE_WITH_PE
531   /* We need to hack badly to handle a PE image correctly.  In PE
532      images created by the GNU linker, the offset to the COFF header
533      is always the size.  However, this is not the case in images
534      generated by other PE linkers.  The PE format stores a four byte
535      offset to the PE signature just before the COFF header at
536      location 0x3c of the file.  We pick up that offset, verify that
537      the PE signature is there, and then set ourselves up to read in
538      the COFF header.  */
539   {
540     bfd_byte ext_offset[4];
541     file_ptr offset;
542     bfd_byte ext_signature[4];
543     unsigned long signature;
544
545     if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
546         || bfd_read (ext_offset, 1, 4, abfd) != 4)
547       {
548         if (bfd_get_error () != bfd_error_system_call)
549           bfd_set_error (bfd_error_wrong_format);
550         return NULL;
551       }
552     offset = bfd_h_get_32 (abfd, ext_offset);
553     if (bfd_seek (abfd, offset, SEEK_SET) != 0
554         || bfd_read (ext_signature, 1, 4, abfd) != 4)
555       {
556         if (bfd_get_error () != bfd_error_system_call)
557           bfd_set_error (bfd_error_wrong_format);
558         return NULL;
559       }
560     signature = bfd_h_get_32 (abfd, ext_signature);
561
562     if (signature != 0x4550)
563       {
564         bfd_set_error (bfd_error_wrong_format);
565         return NULL;
566       }
567
568     /* Here is the hack.  coff_object_p wants to read filhsz bytes to
569        pick up the COFF header.  We adjust so that that will work.  20
570        is the size of the i386 COFF filehdr.  */
571
572     if (bfd_seek (abfd,
573                   (bfd_tell (abfd)
574                    - bfd_coff_filhsz (abfd)
575                    + 20),
576                   SEEK_SET)
577         != 0)
578       {
579         if (bfd_get_error () != bfd_error_system_call)
580           bfd_set_error (bfd_error_wrong_format);
581         return NULL;
582       }
583   }
584 #endif
585
586   return coff_object_p (abfd);
587 }
588
589 const bfd_target
590 #ifdef TARGET_SYM
591   TARGET_SYM =
592 #else
593   i386coff_vec =
594 #endif
595 {
596 #ifdef TARGET_NAME
597   TARGET_NAME,
598 #else
599   "coff-i386",                  /* name */
600 #endif
601   bfd_target_coff_flavour,
602   BFD_ENDIAN_LITTLE,            /* data byte order is little */
603   BFD_ENDIAN_LITTLE,            /* header byte order is little */
604
605   (HAS_RELOC | EXEC_P |         /* object flags */
606    HAS_LINENO | HAS_DEBUG |
607    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
608
609 #ifndef COFF_WITH_PE
610   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
611    | SEC_CODE | SEC_DATA),
612 #else
613   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
614    | SEC_CODE | SEC_DATA
615    | SEC_LINK_ONCE | SEC_LINK_DUPLICATES),
616 #endif
617
618 #ifdef TARGET_UNDERSCORE
619   TARGET_UNDERSCORE,            /* leading underscore */
620 #else
621   0,                            /* leading underscore */
622 #endif
623   '/',                          /* ar_pad_char */
624   15,                           /* ar_max_namelen */
625
626   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
627      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
628      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
629   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
630      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
631      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
632
633 /* Note that we allow an object file to be treated as a core file as well. */
634     {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
635        bfd_generic_archive_p, i3coff_object_p},
636     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
637        bfd_false},
638     {bfd_false, coff_write_object_contents, /* bfd_write_contents */
639        _bfd_write_archive_contents, bfd_false},
640
641      BFD_JUMP_TABLE_GENERIC (coff),
642      BFD_JUMP_TABLE_COPY (coff),
643      BFD_JUMP_TABLE_CORE (_bfd_nocore),
644      BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
645      BFD_JUMP_TABLE_SYMBOLS (coff),
646      BFD_JUMP_TABLE_RELOCS (coff),
647      BFD_JUMP_TABLE_WRITE (coff),
648      BFD_JUMP_TABLE_LINK (coff),
649      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
650
651   NULL,
652   
653   COFF_SWAP_TABLE
654 };