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]

finalize_syms for non-bfd


This change seems to be the easiest and least intrusive way of fixing
non-bfd targets affected by the change to symbol resolution.  It also
happens to fix both problems mentioned in
http://sources.redhat.com/ml/binutils/2001-05/msg00419.html

gas/ChangeLog
	* symbols.c (resolve_symbol_value): Always set segment, even when
	not finalizing symbol value.

-- 
Alan Modra

Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.23
diff -u -p -r1.23 symbols.c
--- symbols.c	2001/05/24 23:44:06	1.23
+++ symbols.c	2001/05/25 09:32:12
@@ -942,7 +942,7 @@ resolve_symbol_value (symp)
 	    {
 	      if (finalize_syms)
 		{
-		  S_SET_SEGMENT (symp, S_GET_SEGMENT (add_symbol));
+		  final_seg = S_GET_SEGMENT (add_symbol);
 		  symp->sy_value.X_op = O_symbol;
 		  symp->sy_value.X_add_symbol = add_symbol;
 		  symp->sy_value.X_add_number = final_val;
@@ -1146,18 +1146,18 @@ resolve_symbol_value (symp)
     }
 
   if (finalize_syms)
-    {
-      S_SET_VALUE (symp, final_val);
+    S_SET_VALUE (symp, final_val);
 
+exit_dont_set_value:
+  /* Always set the segment, even if not finalizing the value.
+     The segment is used to determine whether a symbol is defined.  */
 #if defined (OBJ_AOUT) && ! defined (BFD_ASSEMBLER)
-      /* The old a.out backend does not handle S_SET_SEGMENT correctly
-         for a stab symbol, so we use this bad hack.  */
-      if (final_seg != S_GET_SEGMENT (symp))
+  /* The old a.out backend does not handle S_SET_SEGMENT correctly
+     for a stab symbol, so we use this bad hack.  */
+  if (final_seg != S_GET_SEGMENT (symp))
 #endif
-	S_SET_SEGMENT (symp, final_seg);
-    }
+    S_SET_SEGMENT (symp, final_seg);
 
-exit_dont_set_value:
   /* Don't worry if we can't resolve an expr_section symbol.  */
   if (finalize_syms)
     {


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