Patch: Fix elf_find_function () on a corner case
Alan Modra
amodra@bigpond.net.au
Tue Dec 27 09:19:00 GMT 2005
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
More information about the Binutils
mailing list