2000-11-06 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / gas / subsegs.c
index 70dda27903b9530027e1002e53491718da90b36f..49a93af7ea766f1a5b8e21e1aade70f52b459112 100644 (file)
@@ -1,5 +1,5 @@
 /* subsegs.c - subsegments -
-   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -37,7 +37,7 @@ static struct obstack frchains;
 segment_info_type segment_info[SEG_MAXIMUM_ORDINAL];
 
 #else
-/* Commented in "subsegs.h". */
+/* Commented in "subsegs.h".  */
 frchainS *data0_frchainP, *bss0_frchainP;
 
 #endif /* MANY_SEGMENTS */
@@ -62,7 +62,7 @@ char const *const seg_name[] =
   "transfert vector postload",
   "register",
   "",
-};                             /* Used by error reporters, dumpers etc. */
+};                             /* Used by error reporters, dumpers etc.  */
 #else /* BFD_ASSEMBLER */
 
 /* Gas segment information for bfd_abs_section_ptr and
@@ -103,12 +103,12 @@ subsegs_begin ()
 #endif
 
   frchain_root = NULL;
-  frchain_now = NULL;          /* Warn new_subseg() that we are booting. */
+  frchain_now = NULL;          /* Warn new_subseg() that we are booting.  */
 
   frag_now = &dummy_frag;
 
 #ifndef BFD_ASSEMBLER
-  now_subseg = 42;             /* Lie for 1st call to subseg_new. */
+  now_subseg = 42;             /* Lie for 1st call to subseg_new.  */
 #ifdef MANY_SEGMENTS
   {
     int i;
@@ -275,7 +275,7 @@ subseg_set_rest (seg, subseg)
    */
   if (!frcP
       || (frcP->frch_seg > seg
-         || frcP->frch_subseg > subseg))       /* Kinky logic only works with 2 segments. */
+         || frcP->frch_subseg > subseg))       /* Kinky logic only works with 2 segments.  */
     {
       /*
        * This should be the only code that creates a frchainS.
@@ -307,7 +307,7 @@ subseg_set_rest (seg, subseg)
          seginfo->frchainP = newP;
       }
 #endif
-      
+
       frcP = newP;
     }
   /*
@@ -564,6 +564,51 @@ section_symbol (sec)
 
 #endif /* BFD_ASSEMBLER */
 
+/* Return whether the specified segment is thought to hold text.  */
+
+#ifndef BFD_ASSEMBLER
+const char * const nontext_section_names[] =
+{
+  ".eh_frame",
+  ".gcc_except_table",
+#ifdef OBJ_COFF
+#ifndef COFF_LONG_SECTION_NAMES
+  ".eh_fram",
+  ".gcc_exc",
+#endif
+#endif
+  NULL
+};
+#endif /* ! BFD_ASSEMBLER */
+
+int
+subseg_text_p (sec)
+     segT sec;
+{
+#ifdef BFD_ASSEMBLER
+  return (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) != 0;
+#else /* ! BFD_ASSEMBLER */
+  const char * const *p;
+
+  if (sec == data_section || sec == bss_section)
+    return 0;
+
+  for (p = nontext_section_names; *p != NULL; ++p)
+    {
+      if (strcmp (segment_name (sec), *p) == 0)
+       return 0;
+
+#ifdef obj_segment_name
+      if (strcmp (obj_segment_name (sec), *p) == 0)
+       return 0;
+#endif
+    }
+
+  return 1;
+
+#endif /* ! BFD_ASSEMBLER */
+}
+
 void
 subsegs_print_statistics (file)
      FILE *file;
This page took 0.024492 seconds and 4 git commands to generate.