*** empty log message ***
[deliverable/binutils-gdb.git] / gas / write.c
index a90ee9df44474508d1bb70b6980861cdf585149e..5c336d8bb97b59b44bc474bf984d71d55430b161 100644 (file)
@@ -678,18 +678,11 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED,
 
        /* If this symbol is equated to an undefined or common symbol,
           convert the fixup to being against that symbol.  */
-       if (symbol_equated_reloc_p (sym))
+       if (symbol_equated_reloc_p (sym)
+           || S_IS_WEAKREFR (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;
          }
 
@@ -1483,11 +1476,13 @@ write_object_file (void)
 
          /* Skip symbols which were equated to undefined or common
              symbols.  */
-         if (symbol_equated_reloc_p (symp))
+         if (symbol_equated_reloc_p (symp)
+             || S_IS_WEAKREFR (symp))
            {
              const char *name = S_GET_NAME (symp);
              if (S_IS_COMMON (symp)
                  && !TC_FAKE_LABEL (name)
+                 && !S_IS_WEAKREFR (symp)
                  && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp)))
                {
                  expressionS *e = symbol_get_value_expression (symp);
@@ -1498,12 +1493,6 @@ write_object_file (void)
              continue;
            }
 
-         /* So far, common symbols have been treated like undefined symbols.
-            Put them in the common section now.  */
-         if (S_IS_DEFINED (symp) == 0
-             && S_GET_VALUE (symp) != 0)
-           S_SET_SEGMENT (symp, bfd_com_section_ptr);
-
 #ifdef obj_frob_symbol
          obj_frob_symbol (symp, punt);
 #endif
@@ -1524,7 +1513,8 @@ write_object_file (void)
                 opposites.  Sometimes the former checks flags and the
                 latter examines the name...  */
              || (!S_IS_EXTERNAL (symp)
-                 && (punt || S_IS_LOCAL (symp))
+                 && (punt || S_IS_LOCAL (symp) ||
+                     (S_IS_WEAKREFD (symp) && ! symbol_used_p (symp)))
                  && ! symbol_used_in_reloc_p (symp)))
            {
              symbol_remove (symp, &symbol_rootP, &symbol_lastP);
This page took 0.022966 seconds and 4 git commands to generate.