* elf-hppa.h (elf_hppa_final_link): Use gp val of zero when none
[deliverable/binutils-gdb.git] / bfd / coff-z8k.c
index c1d6a88fbbb5edda26531613c54712006c911a46..52ed81fa077fce8aadcde494394951986872cf90 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Zilog Z800n COFF binaries.
-   Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
+   2004 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
@@ -18,7 +18,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -28,54 +28,48 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "coff/internal.h"
 #include "libcoff.h"
 
-static void extra_case PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, arelent *, bfd_byte *, unsigned int *, unsigned int *));
-static void reloc_processing PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
-static void rtype2howto PARAMS ((arelent *, struct internal_reloc *));
-static int coff_z8k_select_reloc PARAMS ((reloc_howto_type *));
-
 #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
 
 static reloc_howto_type r_imm32 =
-HOWTO (R_IMM32, 0, 2, 32, false, 0,
-       complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff,
-       0xffffffff, false);
+HOWTO (R_IMM32, 0, 2, 32, FALSE, 0,
+       complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff,
+       0xffffffff, FALSE);
 
 static reloc_howto_type r_imm4l =
-HOWTO (R_IMM4L, 0, 0, 4, false, 0,
-       complain_overflow_bitfield, 0, "r_imm4l", true, 0xf, 0xf, false);
+HOWTO (R_IMM4L, 0, 0, 4, FALSE, 0,
+       complain_overflow_bitfield, 0, "r_imm4l", TRUE, 0xf, 0xf, FALSE);
 
 static reloc_howto_type r_da =
-HOWTO (R_IMM16, 0, 1, 16, false, 0,
-       complain_overflow_bitfield, 0, "r_da", true, 0x0000ffff, 0x0000ffff,
-       false);
+HOWTO (R_IMM16, 0, 1, 16, FALSE, 0,
+       complain_overflow_bitfield, 0, "r_da", TRUE, 0x0000ffff, 0x0000ffff,
+       FALSE);
 
 static reloc_howto_type r_imm8 =
-HOWTO (R_IMM8, 0, 0, 8, false, 0,
-       complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff,
-       false);
+HOWTO (R_IMM8, 0, 0, 8, FALSE, 0,
+       complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff,
+       FALSE);
 
 static reloc_howto_type r_rel16 =
-HOWTO (R_REL16, 0, 1, 16, false, 0,
-       complain_overflow_bitfield, 0, "r_rel16", true, 0x0000ffff, 0x0000ffff,
-       true);
+HOWTO (R_REL16, 0, 1, 16, FALSE, 0,
+       complain_overflow_bitfield, 0, "r_rel16", TRUE, 0x0000ffff, 0x0000ffff,
+       TRUE);
 
 static reloc_howto_type r_jr =
-HOWTO (R_JR, 0, 0, 8, true, 0, complain_overflow_signed, 0,
-       "r_jr", true, 0, 0, true);
+HOWTO (R_JR, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,
+       "r_jr", TRUE, 0, 0, TRUE);
 
 static reloc_howto_type r_disp7 =
-HOWTO (R_DISP7, 0, 0, 7, true, 0, complain_overflow_bitfield, 0,
-       "r_disp7", true, 0, 0, true);
+HOWTO (R_DISP7, 0, 0, 7, TRUE, 0, complain_overflow_bitfield, 0,
+       "r_disp7", TRUE, 0, 0, TRUE);
 
 static reloc_howto_type r_callr =
-HOWTO (R_CALLR, 0, 1, 12, true, 0, complain_overflow_signed, 0,
-       "r_callr", true, 0xfff, 0xfff, true);
+HOWTO (R_CALLR, 0, 1, 12, TRUE, 0, complain_overflow_signed, 0,
+       "r_callr", TRUE, 0xfff, 0xfff, TRUE);
 
 /* Turn a howto into a reloc number */
 
 static int
-coff_z8k_select_reloc (howto)
-     reloc_howto_type *howto;
+coff_z8k_select_reloc (reloc_howto_type *howto)
 {
   return howto->type;
 }
@@ -96,9 +90,7 @@ coff_z8k_select_reloc (howto)
 /* Code to turn a r_type into a howto ptr, uses the above howto table.  */
 
 static void
-rtype2howto (internal, dst)
-     arelent * internal;
-     struct internal_reloc *dst;
+rtype2howto (arelent *internal, struct internal_reloc *dst)
 {
   switch (dst->r_type)
     {
@@ -143,12 +135,11 @@ rtype2howto (internal, dst)
  reloc_processing(relent, reloc, symbols, abfd, section)
 
 static void
-reloc_processing (relent, reloc, symbols, abfd, section)
-     arelent * relent;
-     struct internal_reloc * reloc;
-     asymbol ** symbols;
-     bfd * abfd;
-     asection * section;
+reloc_processing (arelent *relent,
+                  struct internal_reloc *reloc,
+                  asymbol **symbols,
+                  bfd *abfd,
+                  asection *section)
 {
   relent->address = reloc->r_vaddr;
   rtype2howto (relent, reloc);
@@ -163,14 +154,13 @@ reloc_processing (relent, reloc, symbols, abfd, section)
 }
 
 static void
-extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
-     bfd * in_abfd;
-     struct bfd_link_info * link_info;
-     struct bfd_link_order * link_order;
-     arelent * reloc;
-     bfd_byte * data;
-     unsigned int * src_ptr;
-     unsigned int * dst_ptr;
+extra_case (bfd *in_abfd,
+            struct bfd_link_info *link_info,
+            struct bfd_link_order *link_order,
+            arelent *reloc,
+            bfd_byte *data,
+            unsigned int *src_ptr,
+            unsigned int *dst_ptr)
 {
   asection * input_section = link_order->u.indirect.section;
 
@@ -197,7 +187,7 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
        {
          bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
                                                    input_section);
-         /* Adresses are 23 bit, and the layout of those in a 32-bit
+         /* Addresses are 23 bit, and the layout of those in a 32-bit
             value is as follows:
               1AAAAAAA xxxxxxxx AAAAAAAA AAAAAAAA
             (A - address bits,  x - ignore).  */
@@ -243,7 +233,8 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
        if (gap > 128 || gap < -128)
          {
            if (! ((*link_info->callbacks->reloc_overflow)
-                  (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+                  (link_info, NULL,
+                   bfd_asymbol_name (*reloc->sym_ptr_ptr),
                    reloc->howto->name, reloc->addend, input_section->owner,
                    input_section, reloc->address)))
              abort ();
@@ -268,10 +259,11 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
          abort ();
        gap /= 2;
 
-       if (gap > 0 || gap < -128)
+       if (gap > 0 || gap < -127)
          {
            if (! ((*link_info->callbacks->reloc_overflow)
-                  (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+                  (link_info, NULL,
+                   bfd_asymbol_name (*reloc->sym_ptr_ptr),
                    reloc->howto->name, reloc->addend, input_section->owner,
                    input_section, reloc->address)))
              abort ();
@@ -295,15 +287,16 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
 
        if (gap & 1)
          abort ();
-       gap /= 2;
-       if (gap > 8191 || gap < -8192)
+       if (gap > 4096 || gap < -4095)
          {
            if (! ((*link_info->callbacks->reloc_overflow)
-                  (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+                  (link_info, NULL,
+                   bfd_asymbol_name (*reloc->sym_ptr_ptr),
                    reloc->howto->name, reloc->addend, input_section->owner,
                    input_section, reloc->address)))
              abort ();
          }
+       gap /= 2;
        bfd_put_16 (in_abfd,
                     (bfd_get_16 ( in_abfd, data + *dst_ptr) & 0xf000) | (-gap & 0x0fff),
                     data + *dst_ptr);
@@ -324,7 +317,8 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
        if (gap > 32767 || gap < -32768)
          {
            if (! ((*link_info->callbacks->reloc_overflow)
-                  (link_info, bfd_asymbol_name (*reloc->sym_ptr_ptr),
+                  (link_info, NULL,
+                   bfd_asymbol_name (*reloc->sym_ptr_ptr),
                    reloc->howto->name, reloc->addend, input_section->owner,
                    input_section, reloc->address)))
              abort ();
@@ -350,4 +344,4 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
   bfd_coff_reloc16_get_relocated_section_contents
 #define coff_bfd_relax_section bfd_coff_reloc16_relax_section
 
-CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL)
+CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL, COFF_SWAP_TABLE)
This page took 0.037885 seconds and 4 git commands to generate.