This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Patch: Fix elf_find_function () on a corner case
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jie Zhang <jzhang918 at gmail dot com>
- Cc: Jan Beulich <JBeulich at novell dot com>, binutils at sourceware dot org
- Date: Tue, 27 Dec 2005 19:49:13 +1030
- Subject: Re: Patch: Fix elf_find_function () on a corner case
- References: <438349D5.5090400@gmail.com> <43835AD1.76F0.0078.0@novell.com> <6f48278f0511220915q2b30de27sff7601064a2c0406@mail.gmail.com> <20051123113547.GK28185@bubble.grove.modra.org> <438B165C.9010505@gmail.com>
On Mon, Nov 28, 2005 at 10:38:20PM +0800, Jie Zhang wrote:
> This is my second try. I'm not sure if the section symbols always come
> first for ld -r output. If so, this patch should work. If not, the state
> machine in elf_find_function () may need rewrite.
I'm applying this simpler change instead.
* elf.c (elf_find_function): Don't ignore section syms.
Simplify filename logic.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.322
diff -u -p -r1.322 elf.c
--- bfd/elf.c 27 Dec 2005 03:45:30 -0000 1.322
+++ bfd/elf.c 27 Dec 2005 09:01:01 -0000
@@ -6686,8 +6686,6 @@ elf_find_function (bfd *abfd ATTRIBUTE_U
if (state == symbol_seen)
state = file_after_symbol_seen;
continue;
- case STT_SECTION:
- continue;
case STT_NOTYPE:
case STT_FUNC:
if (bfd_get_section (&q->symbol) == section
@@ -6696,12 +6694,10 @@ elf_find_function (bfd *abfd ATTRIBUTE_U
{
func = (asymbol *) q;
low_func = q->symbol.value;
- if (file == NULL)
- filename = NULL;
- else if (ELF_ST_BIND (q->internal_elf_sym.st_info) != STB_LOCAL
- && state == file_after_symbol_seen)
- filename = NULL;
- else
+ filename = NULL;
+ if (file != NULL
+ && (ELF_ST_BIND (q->internal_elf_sym.st_info) == STB_LOCAL
+ || state != file_after_symbol_seen))
filename = bfd_asymbol_name (file);
}
break;
--
Alan Modra
IBM OzLabs - Linux Technology Centre