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: equating symbols to undefined


On Mon, Oct 24, 2005 at 06:57:42PM +0200, Jan Beulich wrote:
> >>> "H. J. Lu" <hjl@lucon.org> 24.10.05 17:53:08 >>>
> >On Mon, Oct 24, 2005 at 10:06:04AM +0200, Jan Beulich wrote:
> >> >>> "H. J. Lu" <hjl@lucon.org> 21.10.05 19:02:50 >>>
> >> >".set" can be used to define a local symbol from a global symbol
> to
> >> >avoid relocation. The change was made to prevent the gcc bug.
> >> >
> >> >I still like to see what other assemblers do.
> >> 
> >> I can't say anything about Solaris/HPUX/IRIX/AIX; for what it is
> worth,
> >> MASM supports (non-global) equates to externals (MASM equates
> aren't
> >> exactly like gas' in that, if the expression is not resolvable at
> the
> >> point of definition, it is used as a literal text replacement, and
> >> resolving the expression is then done at point of use). Intel's ias
> (for
> >> ia64) also supports (non-global) equates to externals, and ias'
> support
> >> for equates is much closer to gas'.
> >> 
> >
> >I checked Solaris 9 ia32 assember. It allows ".set" on local symbols
> to
> >global ones. I dropped my objection to allow it in gas.
> 
> Now - are you going to refine your original code changes, or will I
> need to understand all implications of your original changes in order to
> derive a fix?
> 

Does this one work for you?


H.J.
---
2005-10-24  H.J. Lu  <hongjiu.lu@intel.com>

	* write.c (adjust_reloc_syms): Undo the change made on
	2005-04-26 to allow local symbol set to undefined symbol.

--- gas/write.c.undef	2005-08-30 17:32:55.000000000 -0700
+++ gas/write.c	2005-10-24 10:33:13.000000000 -0700
@@ -680,16 +680,8 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_U
 	   convert the fixup to being against that symbol.  */
 	if (symbol_equated_reloc_p (sym))
 	  {
-	    symbolS *new_sym
-	      = symbol_get_value_expression (sym)->X_add_symbol;
-	    const char *name = S_GET_NAME (sym);
-	    if (!S_IS_COMMON (new_sym)
-		&& !TC_FAKE_LABEL (name)
-		&& (!S_IS_EXTERNAL (sym) || S_IS_LOCAL (sym)))
-	      as_bad (_("Local symbol `%s' can't be equated to undefined symbol `%s'"),
-		      name, S_GET_NAME (new_sym));
 	    fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
-	    sym = new_sym;
+	    sym = symbol_get_value_expression (sym)->X_add_symbol;
 	    fixp->fx_addsy = sym;
 	  }
 


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