This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH RFA] dwarf2read.c: symbol relocation in new_symbol()




Seems OK to me.  Can you rearrange the statements in the two code
segments to do things in the same order?

Thanks

Elena

Kevin Buettner writes:
 > AIX5/IA-64 relocates read-only and read/write sections by different
 > amounts.  The patch below fixes dwarf2read.c to account for this
 > scenario.
 > 
 > I was tempted to try to fix the other occurrences of baseaddr in
 > this file, but decided to leave that for one our symtabs/dwarf2
 > experts.
 > 
 > I've tested this patch on linux/x86 w/ -gdwarf-2 and saw no
 > regressions.  (I've also done some limited testing on AIX5 and it does
 > indeed fix the problems that I was seeing.)
 > 
 > Okay to commit?
 > 
 > 	* dwarf2read.c (new_symbol): Relocate address of symbol by the
 > 	base address of the section it is in rather than always using
 > 	the base address of the .text section.
 > 
 > Index: dwarf2read.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/dwarf2read.c,v
 > retrieving revision 1.16
 > diff -u -p -r1.16 dwarf2read.c
 > --- dwarf2read.c	2000/08/04 16:51:47	1.16
 > +++ dwarf2read.c	2000/10/28 20:59:09
 > @@ -4185,7 +4185,10 @@ new_symbol (struct die_info *die, struct
 >  		     the variable is referenced.  */
 >  		  if (SYMBOL_VALUE_ADDRESS (sym))
 >  		    {
 > -		      SYMBOL_VALUE_ADDRESS (sym) += baseaddr;
 > +		      fixup_symbol_section (sym, objfile);
 > +		      SYMBOL_VALUE_ADDRESS (sym) +=
 > +			ANOFFSET (objfile->section_offsets,
 > +			          SYMBOL_SECTION (sym));
 >  		      SYMBOL_CLASS (sym) = LOC_STATIC;
 >  		    }
 >  		  else
 > @@ -4215,8 +4218,11 @@ new_symbol (struct die_info *die, struct
 >  		    }
 >  		  else
 >  		    {
 > +		      fixup_symbol_section (sym, objfile);
 >  		      SYMBOL_CLASS (sym) = LOC_STATIC;
 > -		      SYMBOL_VALUE_ADDRESS (sym) = addr + baseaddr;
 > +		      SYMBOL_VALUE_ADDRESS (sym) =
 > +		        addr + ANOFFSET (objfile->section_offsets,
 > +			                 SYMBOL_SECTION (sym));
 >  		    }
 >  		}
 >  	    }
 > 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]