* bfd-in.h (JUMP_TABLE): Added bfd_reloc_type_lookup and
authorIan Lance Taylor <ian@airs.com>
Tue, 23 Feb 1993 20:24:06 +0000 (20:24 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 23 Feb 1993 20:24:06 +0000 (20:24 +0000)
bfd_make_debug_symbol; they were already in the target structure.
* Adjusted all uses of JUMP_TABLE.
* coffgen.c, libcoff-in.h (coff_bfd_make_debug_symbol): Renamed
from coff_make_debug_symbol.
* libcoff.h: Updated accordingly.

bfd/ChangeLog
bfd/bout.c
bfd/coff-a29k.c
bfd/elf.c
bfd/hppa.c
bfd/ieee.c
bfd/oasys.c
bfd/sco-core.c

index 0598d9c..8c3cfc9 100644 (file)
@@ -1,3 +1,12 @@
+Tue Feb 23 12:17:16 1993  Ian Lance Taylor  (ian@cygnus.com)
+
+       * bfd-in.h (JUMP_TABLE): Added bfd_reloc_type_lookup and
+       bfd_make_debug_symbol; they were already in the target structure.
+       * Adjusted all uses of JUMP_TABLE.
+       * coffgen.c, libcoff-in.h (coff_bfd_make_debug_symbol): Renamed
+       from coff_make_debug_symbol.
+       * libcoff.h: Updated accordingly.
+
 Mon Feb 22 18:40:06 1993  Per Bothner  (bothner@rtl.cygnus.com)
 
        * libcoff.h (obj_raw_syment_coun):  New macro.
index 23687b3..3178db8 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for Intel 960 b.out binaries.
-   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -935,7 +935,7 @@ DEFUN(get_value,(reloc, seclet),
   }
 
   /* Add the value contained in the relocation */
-  value += (short)((reloc->addend) & 0xffff);
+  value += reloc->addend;
   
   return value;
 }
@@ -1182,7 +1182,10 @@ DEFUN(b_out_get_relocated_section_contents,(in_abfd,
          dst_address+=4;
          break;
         case ABS32:
-         bfd_put_32(in_abfd, get_value(reloc, seclet), data+dst_address);
+         bfd_put_32(in_abfd,
+                    (bfd_get_32 (in_abfd, data+src_address)
+                     + get_value(reloc, seclet)),
+                    data+dst_address);
          src_address+=4;
          dst_address+=4;
          break;
@@ -1213,13 +1216,18 @@ DEFUN(b_out_get_relocated_section_contents,(in_abfd,
           {
             bfd_error_vector.undefined_symbol(reloc, seclet);
           }
-          word = (word & ~BAL_MASK) |
-           (((word & BAL_MASK) +
-             symbol->section->output_offset +
-             symbol->section->output_section->vma+
-             symbol->value + reloc->addend - dst_address -
-             ( input_section->output_section->vma + input_section->output_offset))
-            & BAL_MASK);
+          word = ((word & ~BAL_MASK)
+                  | (((word & BAL_MASK)
+                      /* value of symbol */
+                      + symbol->value
+                      /* how far it's moving in this relocation */
+                      + (symbol->section->output_offset
+                         + symbol->section->output_section->vma)
+                      - (input_section->output_section->vma
+                         + input_section->output_offset)
+                      /* addend, of course */
+                      + reloc->addend)
+                     & BAL_MASK));
 
           bfd_put_32(in_abfd,word,  data+dst_address);
           dst_address+=4;
@@ -1236,13 +1244,15 @@ DEFUN(b_out_get_relocated_section_contents,(in_abfd,
           {
             bfd_error_vector.undefined_symbol(reloc, seclet);
           }
-          word = (word & ~PCREL13_MASK) |
-           (((word & PCREL13_MASK) +
-             symbol->section->output_offset +
-             symbol->section->output_section->vma+
-             symbol->value + reloc->addend - dst_address -
-             ( input_section->output_section->vma + input_section->output_offset))
-            & PCREL13_MASK);
+          word = ((word & ~PCREL13_MASK)
+                  | (((word & PCREL13_MASK)
+                      + (symbol->section->output_offset
+                         + symbol->section->output_section->vma)
+                      + symbol->value
+                      + reloc->addend
+                      - (input_section->output_section->vma
+                         + input_section->output_offset))
+                     & PCREL13_MASK));
 
           bfd_put_32(in_abfd,word,  data+dst_address);
           dst_address+=4;
@@ -1292,6 +1302,9 @@ DEFUN(b_out_get_relocated_section_contents,(in_abfd,
 #define aout_32_bfd_get_relocated_section_contents  b_out_get_relocated_section_contents
 #define aout_32_bfd_relax_section                   b_out_relax_section
 #define aout_32_bfd_seclet_link                            bfd_generic_seclet_link
+#define aout_32_bfd_reloc_type_lookup              b_out_reloc_type_lookup
+#define aout_32_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
 bfd_target b_out_vec_big_host =
 {
@@ -1318,7 +1331,7 @@ bfd_target b_out_vec_big_host =
    _bfd_write_archive_contents, bfd_false},
 
   JUMP_TABLE(aout_32),
-  b_out_reloc_type_lookup,
+  (PTR) 0,
 };
 
 
@@ -1346,5 +1359,5 @@ _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16, /* hdrs
     {bfd_false, b_out_write_object_contents,   /* bfd_write_contents */
        _bfd_write_archive_contents, bfd_false},
   JUMP_TABLE(aout_32),
-  b_out_reloc_type_lookup,
+  (PTR) 0
 };
index 126a92d..5f6607e 100644 (file)
@@ -334,6 +334,5 @@ bfd_target a29kcoff_big_vec =
   },
 
   JUMP_TABLE(coff),
-     0, 0,
   COFF_SWAP_TABLE
  };
index 4f66484..9fad4c1 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2209,7 +2209,7 @@ DEFUN(elf_info_to_howto, (abfd, cache_ptr, dst),
   switch (abfd->arch_info->arch)
     {
     case bfd_arch_sparc:
-      BFD_ASSERT (ELF_R_TYPE(dst->r_info) < R_SPARC_max);
+      BFD_ASSERT (ELF_R_TYPE(dst->r_info) < (unsigned char) R_SPARC_max);
       cache_ptr->howto = &elf_sparc_howto_table[ELF_R_TYPE(dst->r_info)];
       break;
 
@@ -2525,6 +2525,10 @@ DEFUN(elf_set_section_contents, (abfd, section, location, offset, count),
  bfd_generic_get_relocated_section_contents
 #define elf_bfd_relax_section bfd_generic_relax_section
 #define elf_bfd_seclet_link bfd_generic_seclet_link
+#define elf_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
+#define elf_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
 bfd_target elf_big_vec =
 {
@@ -2598,14 +2602,6 @@ bfd_target elf_big_vec =
      "elf" */
   JUMP_TABLE(elf),
 
-  /* reloc_type_lookup: How applications can find out about amiga relocation
-     types (see documentation on reloc types).  */
-  NULL,
-
-  /* _bfd_make_debug_symbol:  Back-door to allow format aware applications to
-     create debug symbols while using BFD for everything else. */
-  NULL,
-
   /* backend_data: */
   NULL
 };
@@ -2682,14 +2678,6 @@ bfd_target elf_little_vec =
      "elf" */
   JUMP_TABLE(elf),
 
-  /* reloc_type_lookup: How applications can find out about amiga relocation
-     types (see documentation on reloc types).  */
-  NULL,
-
-  /* _bfd_make_debug_symbol:  Back-door to allow format aware applications to
-     create debug symbols while using BFD for everything else. */
-  NULL,
-
   /* backend_data: */
   NULL
 };
index 5246108..33ac2ac 100644 (file)
@@ -616,6 +616,10 @@ hppa_core_file_matches_executable_p  (core_bfd, exec_bfd)
  bfd_generic_get_relocated_section_contents
 #define hppa_bfd_relax_section bfd_generic_relax_section
 #define hppa_bfd_seclet_link bfd_generic_seclet_link
+#define hppa_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
+#define hppa_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
 bfd_target hppa_vec =
 {
@@ -655,7 +659,8 @@ _do_getb64, _do_putb64,  _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs
     bfd_false,
   },
 #undef hppa
-  JUMP_TABLE(hppa)
+  JUMP_TABLE(hppa),
+  (PTR) 0
 };
 
 #endif /* HOST_HPPAHPUX */
index 4aba2cc..f777241 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for ieee-695 objects.
-   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -209,7 +209,7 @@ DEFUN(ieee_write_expression,(abfd, value, symbol, pcrel, index),
   
      
 
-  if (symbol->section == &bfd_com_section
+  if (bfd_is_com_section (symbol->section)
       || symbol->section == &bfd_und_section) 
   {
     /* Def of a common symbol */
@@ -771,7 +771,8 @@ DEFUN(ieee_get_symtab,(abfd, location),
   ieee_symbol_type *symp;
   static bfd dummy_bfd;
   static asymbol empty_symbol =
-  { &dummy_bfd," ieee empty",(symvalue)0,BSF_DEBUGGING , &bfd_abs_section};
+    /* the_bfd, name, value, attr, section */
+    { &dummy_bfd, " ieee empty", (symvalue)0, BSF_DEBUGGING, &bfd_abs_section};
 
   if (abfd->symcount) 
 {
@@ -917,13 +918,18 @@ DEFUN(ieee_slurp_sections,(abfd),
                break;
              }
            }
-           memcpy(section->name, read_id(&(ieee->h)),8);
+           memcpy((char*)section->name, read_id(&(ieee->h)),8);
            /* Truncate sections to 8 chars */
            if (strlen(section->name) > 8) 
            {
-             section->name[8] = 0;
+             char *copy = bfd_alloc(abfd, 9);
+             memcpy(copy, section->name, 8);
+             copy[8] = 0;
+             section->name = copy;
            }
-             { bfd_vma parent, brother, context;
+           
+          {
+            bfd_vma parent, brother, context;
                parse_int(&(ieee->h), &parent);
                parse_int(&(ieee->h), &brother);
                parse_int(&(ieee->h), &context);
@@ -2606,7 +2612,7 @@ DEFUN(ieee_write_external_part,(abfd),
        p->value = reference_index;
        reference_index++;
       }
-      else if(p->section == &bfd_com_section) {
+      else if (bfd_is_com_section (p->section)) {
        /* This is a weak reference */
        ieee_write_byte(abfd, ieee_external_reference_enum);
        ieee_write_int(abfd, reference_index);
@@ -2967,6 +2973,12 @@ DEFUN(ieee_bfd_debug_info_accumulate,(abfd, section),
 #define ieee_set_arch_mach bfd_default_set_arch_mach
 #define ieee_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define ieee_bfd_relax_section bfd_generic_relax_section
+#define ieee_bfd_seclet_link bfd_generic_seclet_link
+#define ieee_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
+#define ieee_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
+
 /*SUPPRESS 460 */
 bfd_target ieee_vec =
 {
@@ -3003,6 +3015,7 @@ _do_getb64, _do_putb64,  _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs
     _bfd_write_archive_contents,
     bfd_false,
   },
-  JUMP_TABLE(ieee)
+  JUMP_TABLE(ieee),
+  (PTR) 0
 };
 
index 215d305..201fedf 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for oasys objects.
-   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support, <sac@cygnus.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -1311,6 +1311,10 @@ return 0;
 #define oasys_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
 #define oasys_bfd_relax_section bfd_generic_relax_section
 #define oasys_bfd_seclet_link bfd_generic_seclet_link
+#define oasys_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
+#define oasys_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
 /*SUPPRESS 460 */
 bfd_target oasys_vec =
@@ -1348,5 +1352,6 @@ bfd_target oasys_vec =
       _bfd_write_archive_contents,
       bfd_false,
     },
-  JUMP_TABLE(oasys)
+  JUMP_TABLE(oasys),
+  (PTR) 0
 };
index 5cdffb6..ff8faeb 100644 (file)
@@ -251,6 +251,10 @@ sco_core_file_matches_executable_p  (core_bfd, exec_bfd)
 #define sco_bfd_relax_section bfd_generic_relax_section
 #define sco_bfd_seclet_link \
   ((boolean (*) PARAMS ((bfd *, PTR, boolean))) bfd_false)
+#define sco_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
+#define sco_bfd_make_debug_symbol \
+  ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
 
 /* If somebody calls any byte-swapping routines, shoot them.  */
 void
@@ -287,6 +291,7 @@ bfd_target sco_core_vec =
      bfd_false, bfd_false},
     
     JUMP_TABLE(sco),
+    (PTR) 0
 };