(int64e_type): Fix definition.
[deliverable/binutils-gdb.git] / bfd / coffcode.h
index fe3fe0fff0d958772094fc7b492fd347eebde60f..c554276d00c60885b8c5f8116a36ebd925752f54 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for the generic parts of most COFF variants, for BFD.
-   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.
@@ -338,10 +338,16 @@ DEFUN(sec_to_styp_flags, (sec_name, sec_flags),
   {
     styp_flags = STYP_LIB;
 #endif                         /* _LIB */
+#ifdef _LIT
+  }
+  else if (!strcmp (sec_name, _LIT))
+  {
+    styp_flags = STYP_LIT;
+#endif /* _LIT */
 
   }
   /* Try and figure out what it should be */
-  else   if (sec_flags & SEC_CODE) 
+  else if (sec_flags & SEC_CODE) 
   {
     styp_flags = STYP_TEXT;
   }
@@ -413,11 +419,16 @@ DEFUN(styp_to_sec_flags, (abfd, hdr),
   }
   else if (styp_flags & STYP_BSS) 
   {
-    sec_flags |= SEC_ALLOC;
+#ifdef BSS_NOLOAD_IS_SHARED_LIBRARY
+    if (sec_flags & SEC_NEVER_LOAD)
+      sec_flags |= SEC_ALLOC | SEC_SHARED_LIBRARY;
+    else
+#endif
+      sec_flags |= SEC_ALLOC;
   }
   else if (styp_flags & STYP_INFO) 
   {
-    sec_flags |= SEC_NEVER_LOAD;
+    /* Nothing to do.  */
   }
   else
   {
@@ -539,7 +550,8 @@ dependent COFF routines
 .       PTR     internal_filehdr));
 . PTR (*_bfd_coff_mkobject_hook) PARAMS ((
 .       bfd     *abfd,
-.       PTR     internal_filehdr));
+.       PTR     internal_filehdr,
+.       PTR     internal_aouthdr));
 . flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
 .       bfd     *abfd,
 .       PTR     internal_scnhdr));
@@ -557,7 +569,7 @@ dependent COFF routines
 .       struct internal_syment *sym));
 . void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
 .       bfd     *abfd,
-.       bfd_seclet_type *seclet,
+.       struct bfd_seclet *seclet,
 .       arelent *reloc,
 .       bfd_byte *data,
 .       unsigned int *src_ptr,
@@ -617,8 +629,8 @@ dependent COFF routines
 .
 .#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
 .        ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-.#define bfd_coff_mkobject_hook(abfd, filehdr)\
-.        ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr))
+.#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
+.        ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
 .
 .#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
 .        ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))
@@ -756,9 +768,10 @@ DEFUN(coff_mkobject,(abfd),
 /* Create the COFF backend specific information.  */
 
 static          PTR
-DEFUN(coff_mkobject_hook,(abfd, filehdr),
+DEFUN(coff_mkobject_hook,(abfd, filehdr, aouthdr),
       bfd            *abfd AND
-      PTR           filehdr)
+      PTR           filehdr AND
+      PTR           aouthdr)
 {
   struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
   coff_data_type *coff;
@@ -821,15 +834,6 @@ DEFUN (coff_set_arch_mach_hook, (abfd, filehdr),
     break;
 #endif
 
-#ifdef MIPS
-  case  MIPS_MAGIC_1:
-  case  MIPS_MAGIC_2:
-  case  MIPS_MAGIC_3:
-    arch = bfd_arch_mips;
-    machine = 0;
-    break;
-#endif
-
 #ifdef MC68MAGIC
   case MC68MAGIC:
   case M68MAGIC:
@@ -912,6 +916,22 @@ DEFUN (coff_set_arch_mach_hook, (abfd, filehdr),
   case H8300MAGIC:
     arch = bfd_arch_h8300;
     machine = 0;
+    /* !! FIXME this probably isn't the right place for this */
+    abfd->flags |= BFD_IS_RELAXABLE;
+    break;
+#endif
+
+#ifdef SHMAGIC
+  case SHMAGIC:
+    arch = bfd_arch_sh;
+    machine = 0;
+    break;
+#endif
+
+#ifdef H8500MAGIC
+  case H8500MAGIC:
+    arch = bfd_arch_h8500;
+    machine = 0;
     break;
 #endif
 
@@ -1079,12 +1099,6 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
       }
     break;
 #endif
-#ifdef MIPS
-  case bfd_arch_mips:
-    *magicp = MIPS_MAGIC_2;
-    return true;
-    break;
-#endif
 #ifdef I386MAGIC
   case bfd_arch_i386:
     *magicp = I386MAGIC;
@@ -1110,6 +1124,20 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
       return true;
       break;
 #endif
+
+#ifdef SHMAGIC
+  case bfd_arch_sh:
+      *magicp = SHMAGIC;
+      return true;
+      break;
+#endif
+
+#ifdef H8500MAGIC
+    case bfd_arch_h8500:
+      *magicp = H8500MAGIC;
+      return true;
+      break;
+#endif
 #ifdef A29K_MAGIC_BIG
     case bfd_arch_a29k:
       if (abfd->xvec->byteorder_big_p)
@@ -1170,7 +1198,9 @@ DEFUN(coff_compute_section_file_positions,(abfd),
   asection       *current;
   asection     *previous = (asection *)NULL;
   file_ptr        sofar = FILHSZ;
+#ifndef I960
   file_ptr     old_sofar;
+#endif
   if (bfd_get_start_address(abfd)) 
   {
     /*  A start address may have been added to the original file. In this
@@ -1222,6 +1252,14 @@ DEFUN(coff_compute_section_file_positions,(abfd),
       current->_raw_size += sofar - old_sofar ;
 #endif
 
+#ifdef _LIB
+      /* Force .lib sections to start at zero.  The vma is then
+        incremented in coff_set_section_contents.  This is right for
+        SVR3.2.  */
+      if (strcmp (current->name, _LIB) == 0)
+       bfd_set_section_vma (abfd, current, 0);
+#endif
+
       previous = current;
     }
   obj_relocbase(abfd) = sofar;
@@ -1344,7 +1382,7 @@ DEFUN(coff_write_object_contents,(abfd),
   /* Make a pass through the symbol table to count line number entries and
      put them into the correct asections */
 
-  coff_count_linenumbers(abfd);
+  lnno_size =  coff_count_linenumbers(abfd) * LINESZ;
   data_base = scn_base;
 
   /* Work out the size of the reloc and linno areas */
@@ -1357,7 +1395,6 @@ DEFUN(coff_write_object_contents,(abfd),
     {
        
       reloc_size += current->reloc_count * RELSZ;
-      lnno_size += current->lineno_count * LINESZ;
       data_base += SCNHSZ;
     }
       
@@ -1421,8 +1458,8 @@ DEFUN(coff_write_object_contents,(abfd),
          section.s_vaddr = 0;
        else
 #endif
-         section.s_vaddr = current->vma + pad;
-       section.s_paddr = current->vma + pad;
+       section.s_vaddr = current->lma + pad;
+       section.s_paddr = current->lma + pad;
        section.s_size = current->_raw_size - pad;
        /*
          If this section has no size or is unloadable then the scnptr
@@ -1552,10 +1589,10 @@ DEFUN(coff_write_object_contents,(abfd),
   internal_a.magic = PAGEMAGICBCS;
 #endif                         /* M88 */
 
-#if M68 || MIPS || WE32K
+#if M68 || WE32K
 #define __A_MAGIC_SET__
   /* Never was anything here for the 68k */
-#endif                         /* M68 || MIPS || WE32K */
+#endif                         /* M68 || WE32K */
 
 #if I386
 # define __A_MAGIC_SET__
@@ -1634,9 +1671,14 @@ DEFUN(coff_set_section_contents,(abfd, section, location, offset, count),
        right for SVR3.2.  Shared libraries should probably get more
        generic support.  Ian Taylor <ian@cygnus.com>.  */
     if (strcmp (section->name, _LIB) == 0)
-      ++section->vma;
+      ++section->lma;
 #endif
 
+    /* Don't write out bss sections - one way to do this is to 
+       see if the filepos has not been set. */ 
+    if (section->filepos == 0)
+      return true;
+
     bfd_seek(abfd, (file_ptr) (section->filepos + offset), SEEK_SET);
 
     if (count != 0) {
@@ -2181,9 +2223,19 @@ bfd *abfd;
 #endif
 
 #ifndef coff_reloc16_extra_cases
-#define coff_reloc16_extra_cases \
-  (void (*) PARAMS ((bfd *, bfd_seclet_type *, arelent *, bfd_byte *,\
-                    unsigned int *, unsigned int *))) abort
+#define coff_reloc16_extra_cases dummy_reloc16_extra_cases
+/* This works even if abort is not declared in any header file.  */
+void
+dummy_reloc16_extra_cases (abfd, seclet, reloc, data, src_ptr, dst_ptr)
+     bfd *abfd;
+     struct bfd_seclet *seclet;
+     arelent *reloc;
+     bfd_byte *data;
+     unsigned int *src_ptr;
+     unsigned int *dst_ptr;
+{
+  abort ();
+}
 #endif
 
 static CONST bfd_coff_backend_data bfd_coff_std_swap_table = {
@@ -2221,3 +2273,6 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table = {
                        (void (*) PARAMS ((bfd *, struct sec *))) bfd_void
 #define coff_bfd_get_relocated_section_contents  bfd_generic_get_relocated_section_contents
 #define coff_bfd_relax_section         bfd_generic_relax_section
+#define coff_bfd_seclet_link           bfd_generic_seclet_link
+#define coff_bfd_reloc_type_lookup \
+  ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
This page took 0.026106 seconds and 4 git commands to generate.