This makes gprof work with non-standard text sections.
authorJim Wilson <wilson@tuliptree.org>
Fri, 5 Jul 2002 20:29:38 +0000 (20:29 +0000)
committerJim Wilson <wilson@tuliptree.org>
Fri, 5 Jul 2002 20:29:38 +0000 (20:29 +0000)
* syms.c (decode_section_type): New.
(bfd_decode_symclass): Call decode_section_type.

bfd/ChangeLog
bfd/syms.c

index 5727b7e1bda2981315d2505d8a50c1f96953823d..7c00bb49039d6070839853442b980eb5caffe9e2 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-05  Jim Wilson  <wilson@redhat.com>
+
+       * syms.c (decode_section_type): New.
+       (bfd_decode_symclass): Call decode_section_type.
+
 2002-07-04  Jakub Jelinek  <jakub@redhat.com>
 
        * merge.c (_bfd_merged_section_offset): Avoid accessing byte before
index a4f502fc76075c6069f347dea160cfffcefcd0f2..8a8abf45387bc4f90ee8fb44127a423c6b3f351d 100644 (file)
@@ -315,6 +315,7 @@ CODE_FRAGMENT
 #include "aout/stab_gnu.h"
 
 static char coff_section_type PARAMS ((const char *));
+static char decode_section_type PARAMS ((const struct sec *));
 static int cmpindexentry PARAMS ((const PTR, const PTR));
 
 /*
@@ -589,6 +590,41 @@ coff_section_type (s)
   return '?';
 }
 
+/* Return the single-character symbol type corresponding to section
+   SECTION, or '?' for an unknown section.  This uses section flags to
+   identify sections.
+
+   FIXME These types are unhandled: c, i, e, p.  If we handled these also,
+   we could perhaps obsolete coff_section_type.  */
+
+static char
+decode_section_type (section)
+     const struct sec *section;
+{
+  if (section->flags & SEC_CODE)
+    return 't';
+  if (section->flags & SEC_DATA)
+    {
+      if (section->flags & SEC_READONLY)
+       return 'r';
+      else if (section->flags & SEC_SMALL_DATA)
+       return 'g';
+      else
+       return 'd';
+    }
+  if ((section->flags & SEC_HAS_CONTENTS) == 0)
+    {
+      if (section->flags & SEC_SMALL_DATA)
+       return 's';
+      else
+       return 'b';
+    }
+  if (section->flags & SEC_DEBUGGING)
+    return 'N';
+
+  return '?';
+}
+
 /*
 FUNCTION
        bfd_decode_symclass
@@ -639,7 +675,11 @@ bfd_decode_symclass (symbol)
   if (bfd_is_abs_section (symbol->section))
     c = 'a';
   else if (symbol->section)
-    c = coff_section_type (symbol->section->name);
+    {
+      c = coff_section_type (symbol->section->name);
+      if (c == '?')
+       c = decode_section_type (symbol->section);
+    }
   else
     return '?';
   if (symbol->flags & BSF_GLOBAL)