This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Broken Code in gas/symbols.c


Hi Alan,

You are not describing local_symbol_convert accurately. When converted,
your original "struct local_symbol" is modified to contain a pointer to
the newly malloc'd "struct symbol". I don't think there is any need to
modify any of the functions in gas/symbols.c. More likely, you have hit
some code that accesses the fields of "struct symbol" directly rather
than going via accessor functions like symbol_get_bfdsym().


Thanks for the correction. My only concern was the real symbol not getting returned to the caller function. However as you pointed out, it does through local_symbol -> u .lsy_sym.I hadn't noticed the real symbol being stored in local_symbol -> u .lsy_sym. The problem then was that while the arc backend was generating a reloc using tc_gen_reloc the access to bsym was made directly. bsym would be NULL for a local symbol. This would then get stored in the reloc entry created and hence caused the seg fault in bfd_install_relocation. The patch below corrects this problem in tc-arc.c .

Ok to apply ?

regards
Ravi


ChangeLog: 2004-10-01 Ravi Ramaseshan (ravi.ramaseshan@codito.com)

* gas/config/tc-arc.c :
       tc_gen_reloc : Use symbol_get_bfdsym


Index: tc-arc.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-arc.c,v retrieving revision 1.27 diff -a -u -r1.27 tc-arc.c --- tc-arc.c 6 May 2004 11:01:48 -0000 1.27 +++ tc-arc.c 1 Oct 2004 05:40:43 -0000 @@ -1978,8 +1978,9 @@ arelent *reloc;

  reloc = (arelent *) xmalloc (sizeof (arelent));
+  reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));

-  reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+  *reloc->sym_ptr_ptr = symbol_get_bfdsym(fixP->fx_addsy);
  reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
  reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
  if (reloc->howto == (reloc_howto_type *) NULL)




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