This is the mail archive of the 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]

[Patch mach-o/gas] fix thinko in indirect symbol handling.

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.



* 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]