public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch mach-o/gas] fix thinko in indirect symbol handling.
@ 2012-02-10 12:38 Iain Sandoe
  2012-02-10 14:16 ` Tristan Gingold
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2012-02-10 12:38 UTC (permalink / raw)
  To: binutils Development; +Cc: Tristan Gingold

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch mach-o/gas] fix thinko in indirect symbol handling.
  2012-02-10 12:38 [Patch mach-o/gas] fix thinko in indirect symbol handling Iain Sandoe
@ 2012-02-10 14:16 ` Tristan Gingold
  0 siblings, 0 replies; 2+ messages in thread
From: Tristan Gingold @ 2012-02-10 14:16 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: binutils Development


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-10 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 12:38 [Patch mach-o/gas] fix thinko in indirect symbol handling Iain Sandoe
2012-02-10 14:16 ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).