This is the mail archive of the binutils@sourceware.org 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: [Patch mach-o/gas] fix thinko in indirect symbol handling.


On Feb 10, 2012, at 1:37 PM, Iain Sandoe wrote:

> indirect symbols are stored away as we encounter them, and then processed/validated fairly late in the output.
> 
> this causes a problem if one uses a "L" local symbol as an indirect (something which compiler-output doesn't seem to, I only found this with one of my artificial test-cases).
> 
> the problem is that (the output-time) processing of the symbol as an indirect causes it to be 'promoted' to a real one (with a bfd counterpart).  This ICEs GAS because the symtab is frozen by then.
> 
> Anyway, the simplest solution is to force 'promotion' of "L"ocal symbols at the point they are known to be indirect refs.
> 
> OK?

Yes.  For sure this is a particular case, but no reasons not to handle it when it is simple.

Thanks,
Tristan.

> Iain
> 
> gas:
> 
> 	* config/obj-macho.c (obj_mach_o_indirect_symbol): Force promotion of any local
> 	symbol used as an indirect.
> 
> iff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
> index f4706ab..925fe06 100644
> --- a/gas/config/obj-macho.c
> +++ b/gas/config/obj-macho.c
> @@ -1182,6 +1182,11 @@ obj_mach_o_indirect_symbol (int arg ATTRIBUTE_UNUSED)
> 	  }
> 	  *input_line_pointer = c;
> 
> +	  /* The indirect symbols are validated after the symbol table is
> +	     frozen, we must make sure that if a local symbol is used as an
> +	     indirect, it is promoted to a 'real' one.  Fetching the bfd sym
> +	     achieves this.  */
> +	  symbol_get_bfdsym (sym);
> 	  isym = (obj_mach_o_indirect_sym *)
> 			xmalloc (sizeof (obj_mach_o_indirect_sym));
> 
> 


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