2004-01-30 H.J. Lu <hongjiu.lu@intel.com>
[deliverable/binutils-gdb.git] / bfd / aoutx.h
index 9b87de9528bdd2289dc8f92fd76a1e306504d209..3282f87dfe238382fc30f32020082b58a5689b27 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD semi-generic back-end for a.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001, 2002
+   2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -105,9 +105,7 @@ DESCRIPTION
        in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
        to use the
        @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your
-       configuration is selected.
-
-*/
+       configuration is selected.  */
 
 /* Some assumptions:
    * Any BFD with D_PAGED set is ZMAGIC, and vice versa.
@@ -157,9 +155,8 @@ DESCRIPTION
        The standard records contain only an
        address, a symbol index, and a type field. The extended records
        (used on 29ks and sparcs) also have a full integer for an
-       addend.
+       addend.  */
 
-*/
 #ifndef CTOR_TABLE_RELOC_HOWTO
 #define CTOR_TABLE_RELOC_IDX 2
 #define CTOR_TABLE_RELOC_HOWTO(BFD)                                    \
@@ -230,7 +227,8 @@ reloc_howto_type howto_table_ext[] =
 
 /* Convert standard reloc records to "arelent" format (incl byte swap).  */
 
-reloc_howto_type howto_table_std[] = {
+reloc_howto_type howto_table_std[] =
+{
   /* type              rs size bsz  pcrel bitpos ovrf                     sf name     part_inpl readmask  setmask    pcdone.  */
 HOWTO ( 0,            0,  0,   8,  FALSE, 0, complain_overflow_bitfield,0,"8",         TRUE, 0x000000ff,0x000000ff, FALSE),
 HOWTO ( 1,            0,  1,   16, FALSE, 0, complain_overflow_bitfield,0,"16",        TRUE, 0x0000ffff,0x0000ffff, FALSE),
@@ -800,8 +798,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
        case bfd_mach_mips12000:
        case bfd_mach_mips16:
        case bfd_mach_mipsisa32:
+       case bfd_mach_mipsisa32r2:
        case bfd_mach_mips5:
        case bfd_mach_mipsisa64:
+       case bfd_mach_mipsisa64r2:
        case bfd_mach_mips_sb1:
          /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
          arch_flags = M_MIPS2;
@@ -1265,7 +1265,7 @@ bfd_boolean
 NAME(aout,set_section_contents) (abfd, section, location, offset, count)
      bfd *abfd;
      sec_ptr section;
-     PTR location;
+     const PTR location;
      file_ptr offset;
      bfd_size_type count;
 {
@@ -1287,11 +1287,17 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
   if (section != obj_textsec (abfd)
       && section != obj_datasec (abfd))
     {
-      (*_bfd_error_handler)
-       (_("%s: can not represent section `%s' in a.out object file format"),
-        bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
-      bfd_set_error (bfd_error_nonrepresentable_section);
-      return FALSE;
+      if (aout_section_merge_with_text_p (abfd, section))
+       section->filepos = obj_textsec (abfd)->filepos +
+                          (section->vma - obj_textsec (abfd)->vma);
+      else
+       {
+          (*_bfd_error_handler)
+          (_("%s: can not represent section `%s' in a.out object file format"),
+            bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+          bfd_set_error (bfd_error_nonrepresentable_section);
+          return FALSE;
+       }
     }
 
   if (count != 0)
@@ -1703,11 +1709,16 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
     sym_pointer->e_type[0] = N_UNDF | N_EXT;
   else
     {
-      (*_bfd_error_handler)
-       (_("%s: can not represent section `%s' in a.out object file format"),
-        bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
-      bfd_set_error (bfd_error_nonrepresentable_section);
-      return FALSE;
+      if (aout_section_merge_with_text_p (abfd, sec))
+       sym_pointer->e_type[0] |= N_TEXT;
+      else
+       {
+          (*_bfd_error_handler)
+          (_("%s: can not represent section `%s' in a.out object file format"),
+            bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
+          bfd_set_error (bfd_error_nonrepresentable_section);
+          return FALSE;
+       }
     }
 
   /* Turn the symbol from section relative to absolute again.  */
@@ -2015,7 +2026,7 @@ error_return:
 }
 \f
 long
-NAME(aout,get_symtab) (abfd, location)
+NAME(aout,canonicalize_symtab) (abfd, location)
      bfd *abfd;
      asymbol **location;
 {
@@ -3055,9 +3066,10 @@ NAME(aout,link_hash_table_create) (abfd)
   struct aout_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct aout_link_hash_table);
 
-  ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct aout_link_hash_table *) bfd_malloc (amt);
   if (ret == NULL)
     return (struct bfd_link_hash_table *) NULL;
+
   if (! NAME(aout,link_hash_table_init) (ret, abfd,
                                         NAME(aout,link_hash_newfunc)))
     {
@@ -3242,7 +3254,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
             and this object file from the archive includes:
                 int a = 5;
             In such a case, whether to include this object is target
-             dependant for backward compatability.
+             dependant for backward compatibility.
 
             FIXME: The SunOS 4.1.3 linker will pull in the archive
             element if the symbol is defined in the .data section,
@@ -3738,7 +3750,7 @@ NAME(aout,final_link) (abfd, info, callback)
   includes_hash_initialized = TRUE;
 
   /* Figure out the largest section size.  Also, if generating
-     relocateable output, count the relocs.  */
+     relocatable output, count the relocs.  */
   trsize = 0;
   drsize = 0;
   max_contents_size = 0;
@@ -3748,7 +3760,7 @@ NAME(aout,final_link) (abfd, info, callback)
     {
       bfd_size_type sz;
 
-      if (info->relocateable)
+      if (info->relocatable)
        {
          if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
            {
@@ -3762,7 +3774,7 @@ NAME(aout,final_link) (abfd, info, callback)
                 work out the number of relocs needed, and then multiply
                 by the reloc size.  */
              (*_bfd_error_handler)
-               (_("%s: relocateable link from %s to %s not supported"),
+               (_("%s: relocatable link from %s to %s not supported"),
                 bfd_get_filename (abfd),
                 sub->xvec->name, abfd->xvec->name);
              bfd_set_error (bfd_error_invalid_operation);
@@ -3792,7 +3804,7 @@ NAME(aout,final_link) (abfd, info, callback)
        }
     }
 
-  if (info->relocateable)
+  if (info->relocatable)
     {
       if (obj_textsec (abfd) != (asection *) NULL)
        trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
@@ -3894,10 +3906,8 @@ NAME(aout,final_link) (abfd, info, callback)
   for (o = abfd->sections; o != NULL; o = o->next)
     {
       for (p = o->link_order_head; p != NULL; p = p->next)
-       {
-         if (p->type == bfd_indirect_link_order)
-           p->u.indirect.section->linker_mark = TRUE;
-       }
+       if (p->type == bfd_indirect_link_order)
+         p->u.indirect.section->linker_mark = TRUE;
     }
 
   have_link_order_relocs = FALSE;
@@ -4777,9 +4787,9 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
                                  input_size))
     return FALSE;
 
-  /* If we are producing relocateable output, the relocs were
+  /* If we are producing relocatable output, the relocs were
      modified, and we now write them out.  */
-  if (finfo->info->relocateable && rel_size > 0)
+  if (finfo->info->relocatable && rel_size > 0)
     {
       if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
        return FALSE;
@@ -4841,7 +4851,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
             struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
             bfd_vma *));
   bfd *output_bfd;
-  bfd_boolean relocateable;
+  bfd_boolean relocatable;
   struct external_nlist *syms;
   char *strings;
   struct aout_link_hash_entry **sym_hashes;
@@ -4857,7 +4867,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
   BFD_ASSERT (input_bfd->xvec->header_byteorder
              == output_bfd->xvec->header_byteorder);
 
-  relocateable = finfo->info->relocateable;
+  relocatable = finfo->info->relocatable;
   syms = obj_aout_external_syms (input_bfd);
   strings = obj_aout_external_strings (input_bfd);
   sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -4926,9 +4936,9 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
       }
 #endif
 
-      if (relocateable)
+      if (relocatable)
        {
-         /* We are generating a relocateable output file, and must
+         /* We are generating a relocatable output file, and must
             modify the reloc accordingly.  */
          if (r_extern)
            {
@@ -5186,7 +5196,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
             struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
             bfd_vma *));
   bfd *output_bfd;
-  bfd_boolean relocateable;
+  bfd_boolean relocatable;
   struct external_nlist *syms;
   char *strings;
   struct aout_link_hash_entry **sym_hashes;
@@ -5202,7 +5212,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
   BFD_ASSERT (input_bfd->xvec->header_byteorder
              == output_bfd->xvec->header_byteorder);
 
-  relocateable = finfo->info->relocateable;
+  relocatable = finfo->info->relocatable;
   syms = obj_aout_external_syms (input_bfd);
   strings = obj_aout_external_strings (input_bfd);
   sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -5247,9 +5257,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
 
       BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext));
 
-      if (relocateable)
+      if (relocatable)
        {
-         /* We are generating a relocateable output file, and must
+         /* We are generating a relocatable output file, and must
             modify the reloc accordingly.  */
          if (r_extern
              || r_type == (unsigned int) RELOC_BASE10
This page took 0.029506 seconds and 4 git commands to generate.