This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: coffread.c relocation fixes
- From: Elena Zannoni <ezannoni at redhat dot com>
- To: "Raoul Gough" <RaoulGough at yahoo dot co dot uk>
- Cc: <gdb-patches at sources dot redhat dot com>, "Elena Zannoni" <ezannoni at redhat dot com>, mec at shout dot net
- Date: Fri, 23 May 2003 12:25:03 -0400
- Subject: Re: RFC: coffread.c relocation fixes
- References: <b3j1lm$vcn$1@main.gmane.org><16012.44364.781796.157557@localhost.redhat.com><018401c318a5$099c3b10$0200a8c0@albert>
Raoul Gough writes:
> "Elena Zannoni" <ezannoni@redhat.com> wrote in message
> news:16012.44364.781796.157557@localhost.redhat.com...
> > Raoul Gough writes:
> [snip]
> > > The attached exmple shows the problem in action and the attached
> diffs
> > > fix both problems. Do these changes seem sensible to others?
> >
> > I am not a coff expert, but the change seems sensible.
> > See below for a typo.
> > Did you run the gdb testsuite with your patch and w/o? Any
> differences?
>
> I've checked my coffread.c patches against the testsuite, without
> finding any regressions under Cygwin or Linux (not COFF based, so
> there wouldn't be any changes expected, of course). I've also written
> a new testsuite script that demonstrates the problem and tests the
> fix. I've added the script as a note to PR 1132 in GNATS (see
> http://sources.redhat.com/ml/gdb-prs/2003-q2/msg00129.html).
>
I don't have much comments on the test (except that the convention is
to use '-' instead of '_' in file names, and that you need to update
the gdb/config/djgpp/fnchange.lst file). I wonder if instead of 'while 1'
you could use exp_continue. MichaelC?
> I've attached an updated diff to this posting with a fix for the typo
> that Elena identified. Any advice on getting these patches checked in
> and the PR closed? I can't do it myself, since I don't have any write
> access.
>
I can commit it for you.
elena
> Regards,
> Raoul Gough
> Index: coffread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/coffread.c,v
> retrieving revision 1.37
> diff -c -p -r1.37 coffread.c
> *** coffread.c 25 Feb 2003 21:36:17 -0000 1.37
> --- coffread.c 12 May 2003 16:29:47 -0000
> *************** coff_symtab_read (long symtab_offset, un
> *** 869,875 ****
> print_address_symbolic work right without the (now
> gone) "set fast-symbolic-addr off" kludge. */
>
> - /* FIXME: should use mst_abs, and not relocate, if absolute. */
> enum minimal_symbol_type ms_type;
> int sec;
>
> --- 869,874 ----
> *************** coff_symtab_read (long symtab_offset, un
> *** 891,902 ****
> || cs->c_sclass == C_THUMBEXT ?
> mst_bss : mst_file_bss;
> }
> else
> {
> sec = cs_to_section (cs, objfile);
> tmpaddr = cs->c_value;
> ! if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
> ! || cs->c_sclass == C_THUMBEXT)
> tmpaddr += ANOFFSET (objfile->section_offsets, sec);
>
> if (sec == SECT_OFF_TEXT (objfile))
> --- 890,913 ----
> || cs->c_sclass == C_THUMBEXT ?
> mst_bss : mst_file_bss;
> }
> + else if (cs->c_secnum == N_ABS)
> + {
> + /* Use the correct minimal symbol type (and don't
> + relocate) for absolute values. */
> + ms_type = mst_abs;
> + sec = cs_to_section (cs, objfile);
> + tmpaddr = cs->c_value;
> + }
> else
> {
> sec = cs_to_section (cs, objfile);
> tmpaddr = cs->c_value;
> !
> ! /* Statics in a PE file also get relocated */
> ! if (cs->c_sclass == C_EXT
> ! || cs->c_sclass == C_THUMBEXTFUNC
> ! || cs->c_sclass == C_THUMBEXT
> ! || (pe_file && (cs->c_sclass == C_STAT)))
> tmpaddr += ANOFFSET (objfile->section_offsets, sec);
>
> if (sec == SECT_OFF_TEXT (objfile))
> 2003-02-26 Raoul Gough <RaoulGough@yahoo.co.uk>
>
> * coffread.c(coff_symtab_read): DO relocate static symbols from PE
> files, DON'T relocate absolute symbols (and DO use mst_abs).