+/* 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 || sec == absolute_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;
+{
+ frchainS *frchp;
+ fprintf (file, "frag chains:\n");
+ for (frchp = frchain_root; frchp; frchp = frchp->frch_next)
+ {
+ int count = 0;
+ fragS *fragp;
+
+ /* If frch_subseg is non-zero, it's probably been chained onto
+ the end of a previous subsection. Don't count it again. */
+ if (frchp->frch_subseg != 0)
+ continue;
+
+ /* Skip gas-internal sections. */
+ if (segment_name (frchp->frch_seg)[0] == '*')
+ continue;
+
+ for (fragp = frchp->frch_root; fragp; fragp = fragp->fr_next)
+ {
+#if 0
+ switch (fragp->fr_type)
+ {
+ case rs_fill:
+ fprintf (file, "f"); break;
+ case rs_align:
+ fprintf (file, "a"); break;
+ case rs_align_code:
+ fprintf (file, "c"); break;
+ case rs_org:
+ fprintf (file, "o"); break;
+ case rs_machine_dependent:
+ fprintf (file, "m"); break;
+ case rs_space:
+ fprintf (file, "s"); break;
+ case 0:
+ fprintf (file, "0"); break;
+ default:
+ fprintf (file, "?"); break;
+ }
+#endif
+ count++;
+ }
+ fprintf (file, "\n");
+ fprintf (file, "\t%p %-10s\t%10d frags\n", frchp,
+ segment_name (frchp->frch_seg), count);
+ }
+}
+