* tc-pdp11.c: Use VAX float format support for PDP-11 target.
[deliverable/binutils-gdb.git] / gas / config / obj-ecoff.c
index 64892431ad70ab507f03706d3612dfb00c7d80ba..4d055cb62eb814ee97dfa01a28f080ab2f45dfe4 100644 (file)
@@ -1,5 +1,6 @@
 /* ECOFF object file format.
-   Copyright (C) 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
    Contributed by Cygnus Support.
    This file was put together by Ian Lance Taylor <ian@cygnus.com>.
 
@@ -33,6 +34,7 @@
 static int ecoff_sec_sym_ok_for_reloc PARAMS ((asection *));
 static void obj_ecoff_frob_symbol PARAMS ((symbolS *, int *));
 static void ecoff_pop_insert PARAMS ((void));
+static int ecoff_separate_stab_sections PARAMS ((void));
 
 /* These are the pseudo-ops we support in this file.  Only those
    relating to debugging information are supported here.
@@ -83,7 +85,7 @@ const pseudo_typeS obj_pseudo_table[] =
   { "extern",  ecoff_directive_extern, 0 },
 
 #ifndef TC_MIPS
-  /* For TC_MIPS, tc-mips.c adds this. */
+  /* For TC_MIPS, tc-mips.c adds this.  */
   { "weakext", ecoff_directive_weakext, 0 },
 #endif
 
@@ -93,7 +95,7 @@ const pseudo_typeS obj_pseudo_table[] =
   { "verstamp",        s_ignore,               0 },
 
   /* Sentinel.  */
-  { NULL }
+  { NULL,      s_ignore,               0 }
 };
 
 /* Swap out the symbols and debugging information for BFD.  */
@@ -104,7 +106,7 @@ ecoff_frob_file ()
   const struct ecoff_debug_swap * const debug_swap
     = &ecoff_backend (stdoutput)->debug_swap;
   bfd_vma addr;
-  asection *sec;
+  asection **sec;
   HDRR *hdr;
   char *buf;
   char *set;
@@ -139,55 +141,41 @@ ecoff_frob_file ()
     /* bss segment */
     ".sbss", ".bss",
   };
-#define n_names (sizeof (names) / sizeof (names[0]))
+#define n_names ((int) (sizeof (names) / sizeof (names[0])))
+
+  /* Sections that match names, order to be straightened out later.  */
+  asection *secs[n_names];
+  int i;
 
   addr = 0;
-  {
-    /* Sections that match names, order to be straightened out later.  */
-    asection *secs[n_names];
-    /* Linked list of sections with non-matching names.  Random ordering.  */
-    asection *other_sections = 0;
-    /* Pointer to next section, since we're destroying the original
-       ordering.  */
-    asection *next;
-
-    int i;
-
-    for (i = 0; i < n_names; i++)
-      secs[i] = 0;
-    for (sec = stdoutput->sections; sec != (asection *) NULL; sec = next)
-      {
-       next = sec->next;
-       for (i = 0; i < n_names; i++)
-         if (!strcmp (sec->name, names[i]))
-           {
-             secs[i] = sec;
-             break;
-           }
-       if (i == n_names)
+  for (i = 0; i < n_names; i++)
+    secs[i] = 0;
+
+  for (sec = &stdoutput->sections; *sec != (asection *) NULL; )
+    {
+      for (i = 0; i < n_names; i++)
+       if (!strcmp ((*sec)->name, names[i]))
          {
-           bfd_set_section_vma (stdoutput, sec, addr);
-           addr += bfd_section_size (stdoutput, sec);
-           sec->next = other_sections;
-           other_sections = sec;
+           secs[i] = *sec;
+           bfd_section_list_remove (stdoutput, sec);
+           break;
          }
-      }
-    for (i = 0; i < n_names; i++)
-      if (secs[i])
-       {
-         sec = secs[i];
-         bfd_set_section_vma (stdoutput, sec, addr);
-         addr += bfd_section_size (stdoutput, sec);
-       }
-    for (i = n_names - 1; i >= 0; i--)
-      if (secs[i])
+      if (i == n_names)
        {
-         sec = secs[i];
-         sec->next = other_sections;
-         other_sections = sec;
+         bfd_set_section_vma (stdoutput, *sec, addr);
+         addr += bfd_section_size (stdoutput, *sec);
+         sec = &(*sec)->next;
        }
-    stdoutput->sections = other_sections;
-  }
+    }
+  for (i = 0; i < n_names; i++)
+    if (secs[i])
+      {
+       bfd_set_section_vma (stdoutput, secs[i], addr);
+       addr += bfd_section_size (stdoutput, secs[i]);
+      }
+  for (i = n_names - 1; i >= 0; i--)
+    if (secs[i])
+      bfd_section_list_insert (stdoutput, &stdoutput->sections, secs[i]);
 
   /* Build the ECOFF debugging information.  */
   assert (ecoff_data (stdoutput) != 0);
@@ -270,7 +258,7 @@ obj_ecoff_set_ext (sym, ext)
 
 static int
 ecoff_sec_sym_ok_for_reloc (sec)
-     asection *sec;
+     asection *sec ATTRIBUTE_UNUSED;
 {
   return 1;
 }
@@ -278,7 +266,7 @@ ecoff_sec_sym_ok_for_reloc (sec)
 static void
 obj_ecoff_frob_symbol (sym, puntp)
      symbolS *sym;
-     int *puntp;
+     int *puntp ATTRIBUTE_UNUSED;
 {
   ecoff_frob_symbol (sym);
 }
@@ -289,22 +277,44 @@ ecoff_pop_insert ()
   pop_insert (obj_pseudo_table);
 }
 
+static int
+ecoff_separate_stab_sections ()
+{
+  return 0;
+}
+
 const struct format_ops ecoff_format_ops =
 {
   bfd_target_ecoff_flavour,
-  0,
-  1,
+  0,   /* dfl_leading_underscore */
+
+  /* FIXME: A comment why emit_section_symbols is different here (1) from
+     the single-format definition (0) would be in order.  */
+  1,   /* emit_section_symbols */
+  0,   /* begin */
+  ecoff_new_file,
   obj_ecoff_frob_symbol,
   ecoff_frob_file,
-  0,
-  0, 0,
-  0, 0,
-  0,
+  0,   /* frob_file_before_adjust */
+  0,   /* frob_file_after_relocs */
+  0,   /* s_get_size */
+  0,   /* s_set_size */
+  0,   /* s_get_align */
+  0,   /* s_set_align */
+  0,   /* s_get_other */
+  0,   /* s_set_other */
+  0,   /* s_get_desc */
+  0,   /* s_set_desc */
+  0,   /* s_get_type */
+  0,   /* s_set_type */
+  0,   /* copy_symbol_attributes */
   ecoff_generate_asm_lineno,
   ecoff_stab,
+  ecoff_separate_stab_sections,
+  0,   /* init_stab_section */
   ecoff_sec_sym_ok_for_reloc,
   ecoff_pop_insert,
   ecoff_set_ext,
   ecoff_read_begin_hook,
-  ecoff_symbol_new_hook,
+  ecoff_symbol_new_hook
 };
This page took 0.027344 seconds and 4 git commands to generate.