[PATCH] elfread.c 'offset' fix
Elena Zannoni
ezannoni@cygnus.com
Thu May 4 13:27:00 GMT 2000
This is basically a resubmission of an old patch from Amit Kale
( http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00054.html ),
but now it works on top of all the other changes I checked in earlier.
Elena
2000-05-04 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* elfread.c (elf_symtab_read): The calculation of 'offset'
must be done for each symbol, not just once. The index
used must be the index of the section where 'sym' resides,
not .text.
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.5
diff -u -p -r1.5 elfread.c
--- elfread.c 2000/05/04 16:52:33 1.5
+++ elfread.c 2000/05/04 20:05:57
@@ -293,8 +293,7 @@ elf_symtab_read (objfile, dynamic)
if (number_of_symbols < 0)
error ("Can't read symbols from %s: %s", bfd_get_filename (objfile->obfd),
bfd_errmsg (bfd_get_error ()));
- /* FIXME: Should use section specific offset, not SECT_OFF_TEXT. */
- offset = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
+
for (i = 0; i < number_of_symbols; i++)
{
sym = symbol_table[i];
@@ -305,6 +304,7 @@ elf_symtab_read (objfile, dynamic)
continue;
}
+ offset = ANOFFSET (objfile->section_offsets, sym->section->index);
if (dynamic
&& sym->section == &bfd_und_section
&& (sym->flags & BSF_FUNCTION))
More information about the Gdb-patches
mailing list