Mon Jul 3 13:55:18 1995 Steve Chamberlain <sac@slash.cygnus.com>
[deliverable/binutils-gdb.git] / bfd / coff-sh.c
index 3caaaf7de73838c15b7349ccd0523ad43f0c87bb..960d9ac6dee1bcb008377e0e699e46594b7f0ed4 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end for Hitachi Super-H COFF binaries.
-   Copyright 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    Written by Steve Chamberlain, <sac@cygnus.com>.
 
@@ -30,31 +30,26 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 static bfd_reloc_status_type sh_reloc();
 
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+
+/*#define COFF_LONG_FILENAMES*/
 
 static reloc_howto_type r_imm32 =
   {R_SH_IMM32,  0, 2, 32, false, 0, 
      complain_overflow_bitfield, sh_reloc,"r_imm32",    true, 0xffffffff,0xffffffff, false};
 
 
-/*#define SELECT_RELOC(x,y) x->howto = (&r_imm32)*/
-
-
 #define BADMAG(x) SHBADMAG(x)
 #define SH 1                   /* Customize coffcode.h */
 
 #define __A_MAGIC_SET__
 
 /* Code to swap in the reloc */
-#if 0
-#define SWAP_IN_RELOC_OFFSET   bfd_h_get_32
-#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
-#endif
 #define SWAP_OUT_RELOC_EXTRA(abfd, src, dst) \
   dst->r_stuff[0] = 'S'; \
   dst->r_stuff[1] = 'C';
 
-/* Code to turn a r_type into a howto ptr, uses the above howto table
-   */
+/* Code to turn a r_type into a howto ptr, uses the above howto table.  */
 static long
 get_symbol_value (symbol)       
      asymbol *symbol;
@@ -75,31 +70,8 @@ get_symbol_value (symbol)
   return(relocation);
 }
 
-static void
-rtype2howto (internal, dst)
-     arelent * internal;
-     struct internal_reloc *dst;
-{
-  switch (dst->r_type)
-    {
-    default:
-      abort();
-    case R_SH_IMM32:
-
-      break;
-    }
-}
-
 #define RTYPE2HOWTO(x,y) ((x)->howto = &r_imm32)
 
-/* Perform any necessaru magic to the addend in a reloc entry */
-
-#if 0
-#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
- cache_ptr->addend =  ext_reloc.r_offset;
-
-#endif
-
 
 /* Compute the addend of a reloc.  If the reloc is to a common symbol,
    the object file contains the value of the common symbol.  By the
@@ -132,11 +104,6 @@ rtype2howto (internal, dst)
       cache_ptr->addend = 0;                                   \
   }
 
-#if 0
-#define RELOC_PROCESSING(relent,reloc,symbols,abfd,section) \
- reloc_processing(relent, reloc, symbols, abfd, section)
-#endif
-
 /* this function is in charge of performing all the 29k relocations */
 
 static bfd_reloc_status_type
@@ -180,8 +147,8 @@ sh_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
   switch (r_type) 
     {
     case R_SH_IMM32:
-      /* We ignore the previous contents ! */
       insn = sym_value + reloc_entry->addend;  
+      insn += bfd_get_32 (abfd, hit_data);
       bfd_put_32(abfd, insn, hit_data);
       break;
     default:
@@ -227,7 +194,6 @@ coff_sh_relocate_section (output_bfd, info, input_bfd, input_section,
       struct internal_syment *sym;
       asection *sec;
       bfd_vma val;
-      bfd_reloc_status_type rstat;
 
       symndx = rel->r_symndx;
       loc = contents + rel->r_vaddr - input_section->vma;
@@ -253,7 +219,6 @@ coff_sh_relocate_section (output_bfd, info, input_bfd, input_section,
              val = (sec->output_section->vma
                     + sec->output_offset
                     + sym->n_value
-                    - sec->vma 
                     - sec->vma);
            }
        }
@@ -296,40 +261,7 @@ coff_sh_relocate_section (output_bfd, info, input_bfd, input_section,
   return true;
 }
 
-static void 
-reloc_processing (relent, reloc, symbols, abfd, section)
-     arelent * relent;
-     struct internal_reloc *reloc;
-     asymbol ** symbols;
-     bfd * abfd;
-     asection * section;
-{
-  asymbol *ptr;
-  relent->address = reloc->r_vaddr;
-  relent->howto = &r_imm32;
-
-
-  relent->sym_ptr_ptr = symbols + obj_convert(abfd)[reloc->r_symndx];
-
-  ptr = *(relent->sym_ptr_ptr);
-
-  if (ptr 
-      && bfd_asymbol_bfd(ptr) == abfd          
-
-      && ((ptr->flags & BSF_OLD_COMMON)== 0))  
-    {                                          
-      relent->addend = 0;
-    }                                          
-  else
-    {                                  
-      relent->addend = 0;                      
-    }                  
-  relent->address-= section->vma;
-
-}
-
 #define coff_relocate_section coff_sh_relocate_section
-
 #include "coffcode.h"
 
 const bfd_target shcoff_vec =
@@ -375,3 +307,49 @@ const bfd_target shcoff_vec =
     COFF_SWAP_TABLE,
 };
 
+const bfd_target shlcoff_vec =
+{
+  "coff-shl",                  /* name */
+  bfd_target_coff_flavour,
+  false,                       /* data byte order is little */
+  false,                       /* header byte order is little endian too*/
+
+  (HAS_RELOC | EXEC_P |                /* object flags */
+   HAS_LINENO | HAS_DEBUG |
+   HAS_SYMS | HAS_LOCALS | WP_TEXT | BFD_IS_RELAXABLE ),
+
+  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),       /* section flags */
+  '_',                         /* leading symbol underscore */
+  '/',                         /* ar_pad_char */
+  15,                          /* ar_max_namelen */
+  2,                           /* minimum section alignment */
+     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+/* Note that we use a special archive recognizer.
+   This is so that we only use one archive format for both
+   object file types */
+  {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
+     _bfd_dummy_target, _bfd_dummy_target},   
+  {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
+     bfd_false},
+  {bfd_false, coff_write_object_contents,      /* bfd_write_contents */
+     _bfd_write_archive_contents, bfd_false},
+
+     BFD_JUMP_TABLE_GENERIC (coff),
+     BFD_JUMP_TABLE_COPY (coff),
+     BFD_JUMP_TABLE_CORE (_bfd_nocore),
+     BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+     BFD_JUMP_TABLE_SYMBOLS (coff),
+     BFD_JUMP_TABLE_RELOCS (coff),
+     BFD_JUMP_TABLE_WRITE (coff),
+     BFD_JUMP_TABLE_LINK (coff),
+     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+    COFF_SWAP_TABLE,
+};
+
This page took 0.028292 seconds and 4 git commands to generate.