Correct spelling of "relocatable".
[deliverable/binutils-gdb.git] / bfd / coff-i860.c
index e07f9d4e661c1fd141a6db3a39355e4824fdf66f..b862ff7f0c292b0f3c227a5acaa7d7bc40420596 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for Intel 860 COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 97, 1999 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003
+   Free Software Foundation, Inc.
    Created mostly by substituting "860" for "386" in coff-i386.c
    Harry Dolan <dolan@ssd.intel.com>, October 1995
 
@@ -29,12 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "libcoff.h"
 
-static bfd_reloc_status_type coff_i860_reloc 
+static bfd_reloc_status_type coff_i860_reloc
   PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
 static reloc_howto_type *coff_i860_rtype_to_howto
   PARAMS ((bfd *, asection *, struct internal_reloc *,
           struct coff_link_hash_entry *, struct internal_syment *,
           bfd_vma *));
+static const bfd_target * i3coff_object_p PARAMS ((bfd *));
 
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
 /* The page size is a guess based on ELF.  */
@@ -45,7 +47,7 @@ static reloc_howto_type *coff_i860_rtype_to_howto
    section for a reference to a common symbol is the value itself plus
    any desired offset.  Ian Taylor, Cygnus Support.  */
 
-/* If we are producing relocateable output, we need to do some
+/* If we are producing relocatable output, we need to do some
    adjustments to the object file that are not done by the
    bfd_perform_relocation function.  This function is called by every
    reloc type to make any required adjustments.  */
@@ -66,7 +68,6 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
   if (output_bfd == (bfd *) NULL)
     return bfd_reloc_continue;
 
-
   if (bfd_is_com_section (symbol->section))
     {
       /* We are relocating a common symbol.  The current value in the
@@ -86,12 +87,11 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
     {
       /* For some reason bfd_perform_relocation always effectively
         ignores the addend for a COFF target when producing
-        relocateable output.  This seems to be always wrong for 860
+        relocatable output.  This seems to be always wrong for 860
         COFF, so we handle the addend here instead.  */
       diff = reloc_entry->addend;
     }
 
-
 #define DOIT(x) \
   x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
 
@@ -114,7 +114,7 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
            {
              short x = bfd_get_16 (abfd, addr);
              DOIT (x);
-             bfd_put_16 (abfd, x, addr);
+             bfd_put_16 (abfd, (bfd_vma) x, addr);
            }
            break;
 
@@ -122,7 +122,7 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
            {
              long x = bfd_get_32 (abfd, addr);
              DOIT (x);
-             bfd_put_32 (abfd, x, addr);
+             bfd_put_32 (abfd, (bfd_vma) x, addr);
            }
            break;
 
@@ -136,10 +136,10 @@ coff_i860_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
 }
 
 #ifndef PCRELOFFSET
-#define PCRELOFFSET false
+#define PCRELOFFSET FALSE
 #endif
 
-static reloc_howto_type howto_table[] = 
+static reloc_howto_type howto_table[] =
 {
   EMPTY_HOWTO (0),
   EMPTY_HOWTO (1),
@@ -147,33 +147,33 @@ static reloc_howto_type howto_table[] =
   EMPTY_HOWTO (3),
   EMPTY_HOWTO (4),
   EMPTY_HOWTO (5),
-  HOWTO (R_DIR32,               /* type */                                 
-        0,                     /* rightshift */                           
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        32,                    /* bitsize */                   
-        false,                 /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_DIR32,               /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "dir32",               /* name */                                 
-        true,                  /* partial_inplace */                      
-        0xffffffff,            /* src_mask */                             
-        0xffffffff,            /* dst_mask */                             
-        true),                /* pcrel_offset */
+        coff_i860_reloc,       /* special_function */
+        "dir32",               /* name */
+        TRUE,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        TRUE),                /* pcrel_offset */
   /* {7}, */
-  HOWTO (R_IMAGEBASE,            /* type */                                 
-        0,                     /* rightshift */                           
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        32,                    /* bitsize */                   
-        false,                 /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_IMAGEBASE,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "rva32",                  /* name */                                 
-        true,                  /* partial_inplace */                      
-        0xffffffff,            /* src_mask */                             
-        0xffffffff,            /* dst_mask */                             
-        false),                /* pcrel_offset */
+        coff_i860_reloc,       /* special_function */
+        "rva32",                  /* name */
+        TRUE,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
+        FALSE),                /* pcrel_offset */
   EMPTY_HOWTO (010),
   EMPTY_HOWTO (011),
   EMPTY_HOWTO (012),
@@ -181,83 +181,83 @@ static reloc_howto_type howto_table[] =
   EMPTY_HOWTO (014),
   EMPTY_HOWTO (015),
   EMPTY_HOWTO (016),
-  HOWTO (R_RELBYTE,            /* type */                                 
-        0,                     /* rightshift */                           
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        8,                     /* bitsize */                   
-        false,                 /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_RELBYTE,            /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        8,                     /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "8",                   /* name */                                 
-        true,                  /* partial_inplace */                      
-        0x000000ff,            /* src_mask */                             
-        0x000000ff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "8",                   /* name */
+        TRUE,                  /* partial_inplace */
+        0x000000ff,            /* src_mask */
+        0x000000ff,            /* dst_mask */
         PCRELOFFSET),          /* pcrel_offset */
-  HOWTO (R_RELWORD,            /* type */                                 
-        0,                     /* rightshift */                           
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        16,                    /* bitsize */                   
-        false,                 /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_RELWORD,            /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "16",                  /* name */                                 
-        true,                  /* partial_inplace */                      
-        0x0000ffff,            /* src_mask */                             
-        0x0000ffff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "16",                  /* name */
+        TRUE,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
         PCRELOFFSET),          /* pcrel_offset */
-  HOWTO (R_RELLONG,            /* type */                                 
-        0,                     /* rightshift */                           
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        32,                    /* bitsize */                   
-        false,                 /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_RELLONG,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_bitfield, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "32",                  /* name */                                 
-        true,                  /* partial_inplace */                      
-        0xffffffff,            /* src_mask */                             
-        0xffffffff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "32",                  /* name */
+        TRUE,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
         PCRELOFFSET),          /* pcrel_offset */
-  HOWTO (R_PCRBYTE,            /* type */                                 
-        0,                     /* rightshift */                           
-        0,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        8,                     /* bitsize */                   
-        true,                  /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_PCRBYTE,            /* type */
+        0,                     /* rightshift */
+        0,                     /* size (0 = byte, 1 = short, 2 = long) */
+        8,                     /* bitsize */
+        TRUE,                  /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "DISP8",               /* name */                                 
-        true,                  /* partial_inplace */                      
-        0x000000ff,            /* src_mask */                             
-        0x000000ff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "DISP8",               /* name */
+        TRUE,                  /* partial_inplace */
+        0x000000ff,            /* src_mask */
+        0x000000ff,            /* dst_mask */
         PCRELOFFSET),          /* pcrel_offset */
-  HOWTO (R_PCRWORD,            /* type */                                 
-        0,                     /* rightshift */                           
-        1,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        16,                    /* bitsize */                   
-        true,                  /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_PCRWORD,            /* type */
+        0,                     /* rightshift */
+        1,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        TRUE,                  /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "DISP16",              /* name */                                 
-        true,                  /* partial_inplace */                      
-        0x0000ffff,            /* src_mask */                             
-        0x0000ffff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "DISP16",              /* name */
+        TRUE,                  /* partial_inplace */
+        0x0000ffff,            /* src_mask */
+        0x0000ffff,            /* dst_mask */
         PCRELOFFSET),          /* pcrel_offset */
-  HOWTO (R_PCRLONG,            /* type */                                 
-        0,                     /* rightshift */                           
-        2,                     /* size (0 = byte, 1 = short, 2 = long) */ 
-        32,                    /* bitsize */                   
-        true,                  /* pc_relative */                          
-        0,                     /* bitpos */                               
+  HOWTO (R_PCRLONG,            /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        32,                    /* bitsize */
+        TRUE,                  /* pc_relative */
+        0,                     /* bitpos */
         complain_overflow_signed, /* complain_on_overflow */
-        coff_i860_reloc,       /* special_function */                     
-        "DISP32",              /* name */                                 
-        true,                  /* partial_inplace */                      
-        0xffffffff,            /* src_mask */                             
-        0xffffffff,            /* dst_mask */                             
+        coff_i860_reloc,       /* special_function */
+        "DISP32",              /* name */
+        TRUE,                  /* partial_inplace */
+        0xffffffff,            /* src_mask */
+        0xffffffff,            /* dst_mask */
         PCRELOFFSET)           /* pcrel_offset */
 };
 
@@ -335,23 +335,22 @@ coff_i860_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
         function will be adding in the final value of the symbol.  We
         need to subtract out the current size in order to get the
         correct result.  */
-      BFD_ASSERT (h != NULL);
 
+      BFD_ASSERT (h != NULL);
 
       /* I think we *do* want to bypass this.  If we don't, I have seen some data
         parameters get the wrong relcation address.  If I link two versions
         with and without this section bypassed and then do a binary comparison,
-        the addresses which are different can be looked up in the map.  The 
+        the addresses which are different can be looked up in the map.  The
         case in which this section has been bypassed has addresses which correspond
-        to values I can find in the map */
+        to values I can find in the map */
       *addendp -= sym->n_value;
     }
 
   /* If the output symbol is common (in which case this must be a
-     relocateable link), we need to add in the final size of the
+     relocatable link), we need to add in the final size of the
      common symbol.  */
-  if (h != NULL && h->root.type == bfd_link_hash_common) 
+  if (h != NULL && h->root.type == bfd_link_hash_common)
     *addendp += h->root.u.c.size;
 
   return howto;
@@ -365,7 +364,7 @@ static const bfd_target *
 i3coff_object_p(a)
      bfd *a;
 {
-  return coff_object_p(a);
+  return coff_object_p (a);
 }
 
 const bfd_target
@@ -400,7 +399,7 @@ const bfd_target
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well.  */
     {_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
        bfd_generic_archive_p, i3coff_object_p},
     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
@@ -418,5 +417,7 @@ const bfd_target
      BFD_JUMP_TABLE_LINK (coff),
      BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
 
-  COFF_SWAP_TABLE,
+  NULL,
+
+  COFF_SWAP_TABLE
 };
This page took 0.030592 seconds and 4 git commands to generate.