This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [PATCH] elfread.c 'offset' fix
- To: Elena Zannoni <ezannoni at cygnus dot com>
- Subject: Re: [PATCH] elfread.c 'offset' fix
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Fri, 5 May 2000 15:09:40 -0400 (EDT)
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <14609.56615.344999.685756@kwikemart.cygnus.com>
I just checked this in.
Elena
Elena Zannoni writes:
>
> 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))
>