aboutsummaryrefslogtreecommitdiff
path: root/bfd/syms.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>2002-07-05 20:29:38 +0000
committerJim Wilson <wilson@tuliptree.org>2002-07-05 20:29:38 +0000
commitb3212001cad99e7e3e1ddeb17c0b7514b4e58971 (patch)
tree5ac24b783408cdd6adb38b9b4c17140fbe5c12a8 /bfd/syms.c
parent79d5b63a4560a9be0c4bbcfc38c7615cd13b735e (diff)
downloadfsf-binutils-gdb-b3212001cad99e7e3e1ddeb17c0b7514b4e58971.zip
fsf-binutils-gdb-b3212001cad99e7e3e1ddeb17c0b7514b4e58971.tar.gz
fsf-binutils-gdb-b3212001cad99e7e3e1ddeb17c0b7514b4e58971.tar.bz2
This makes gprof work with non-standard text sections.
* syms.c (decode_section_type): New. (bfd_decode_symclass): Call decode_section_type.
Diffstat (limited to 'bfd/syms.c')
-rw-r--r--bfd/syms.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/bfd/syms.c b/bfd/syms.c
index a4f502f..8a8abf4 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -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)