This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Use is_function_type to check function symbol
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 24 Feb 2009 12:50:52 -0800
- Subject: PATCH: Use is_function_type to check function symbol
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
elf_find_function should use is_function_type to check function
symbol. OK to install?
Thanks.
H.J.
--
2009-02-24 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (elf_find_function): Use is_function_type to check
function symbol.
Index: bfd/elf.c
===================================================================
--- bfd/elf.c (revision 5329)
+++ bfd/elf.c (working copy)
@@ -7041,7 +7041,7 @@ _bfd_elf_set_arch_mach (bfd *abfd,
for error reporting. */
static bfd_boolean
-elf_find_function (bfd *abfd ATTRIBUTE_UNUSED,
+elf_find_function (bfd *abfd,
asection *section,
asymbol **symbols,
bfd_vma offset,
@@ -7061,6 +7061,7 @@ elf_find_function (bfd *abfd ATTRIBUTE_U
make a better choice of file name for local symbols by ignoring
file symbols appearing after a given local symbol. */
enum { nothing_seen, symbol_seen, file_after_symbol_seen } state;
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
filename = NULL;
func = NULL;
@@ -7071,20 +7072,22 @@ elf_find_function (bfd *abfd ATTRIBUTE_U
for (p = symbols; *p != NULL; p++)
{
elf_symbol_type *q;
+ unsigned int type;
q = (elf_symbol_type *) *p;
- switch (ELF_ST_TYPE (q->internal_elf_sym.st_info))
+ type = ELF_ST_TYPE (q->internal_elf_sym.st_info);
+ switch (type)
{
- default:
- break;
case STT_FILE:
file = &q->symbol;
if (state == symbol_seen)
state = file_after_symbol_seen;
continue;
+ default:
+ if (!bed->is_function_type (type))
+ break;
case STT_NOTYPE:
- case STT_FUNC:
if (bfd_get_section (&q->symbol) == section
&& q->symbol.value >= low_func
&& q->symbol.value <= offset)