Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Raoul Gough" <RaoulGough@yahoo.co.uk>
To: <gdb-patches@sources.redhat.com>
Cc: "Elena Zannoni" <ezannoni@redhat.com>
Subject: Re: RFC: coffread.c relocation fixes
Date: Mon, 12 May 2003 16:38:00 -0000	[thread overview]
Message-ID: <018401c318a5$099c3b10$0200a8c0@albert> (raw)
In-Reply-To: <16012.44364.781796.157557@localhost.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1072 bytes --]

"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'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.

Regards,
Raoul Gough

[-- Attachment #2: coffread.c.diff.txt --]
[-- Type: text/plain, Size: 1861 bytes --]

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))

[-- Attachment #3: ChangeLog_entry.txt --]
[-- Type: text/plain, Size: 182 bytes --]

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).

  parent reply	other threads:[~2003-05-12 16:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-26 18:40 Raoul Gough
2003-04-03 21:48 ` Elena Zannoni
2003-04-07 11:54   ` Raoul Gough
2003-05-12 16:38   ` Raoul Gough [this message]
2003-05-23 16:19     ` Elena Zannoni
2003-05-28 15:04       ` Raoul Gough
2003-05-28 15:42         ` Eli Zaretskii
2003-05-23 18:42 Michael Elizabeth Chastain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='018401c318a5$099c3b10$0200a8c0@albert' \
    --to=raoulgough@yahoo.co.uk \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox