Apply Nick Clifton's suggestion.
[deliverable/binutils-gdb.git] / gas / config / obj-bout.c
index cbbffae8912b79f786f18c2b13e84fd24020f3ca..dc79718620a42b30a684632449bcb0859970649b 100644 (file)
@@ -1,5 +1,6 @@
 /* b.out object file format
-   Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996
+   Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
    the GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public
-   License along with GAS; see the file COPYING.  If not, write
-   to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+   You should have received a copy of the GNU General Public License
+   along with GAS; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA. */
 
 #include "as.h"
 #include "obstack.h"
@@ -93,9 +95,17 @@ obj_emit_relocations (where, fixP, segment_address_in_file)
 {
   for (; fixP; fixP = fixP->fx_next)
     {
-      if (fixP->fx_addsy != NULL
+      if (fixP->fx_done == 0
          || fixP->fx_r_type != NO_RELOC)
        {
+         symbolS *sym;
+
+         sym = fixP->fx_addsy;
+         while (sym->sy_value.X_op == O_symbol
+                && (! S_IS_DEFINED (sym) || S_IS_COMMON (sym)))
+           sym = sym->sy_value.X_add_symbol;
+         fixP->fx_addsy = sym;
+
          tc_bout_fix_to_chars (*where, fixP, segment_address_in_file);
          *where += sizeof (struct relocation_info);
        }                       /* if there's a symbol */
@@ -208,8 +218,7 @@ obj_symbol_new_hook (symbolP)
 {
   S_SET_OTHER (symbolP, 0);
   S_SET_DESC (symbolP, 0);
-  return;
-}                              /* obj_symbol_new_hook() */
+}
 
 static void
 obj_bout_line (ignore)
@@ -225,8 +234,7 @@ obj_bout_line (ignore)
 void
 obj_read_begin_hook ()
 {
-  return;
-}                              /* obj_read_begin_hook() */
+}
 
 void
 obj_crawl_symbol_chain (headers)
@@ -241,12 +249,21 @@ obj_crawl_symbol_chain (headers)
   symbolPP = &symbol_rootP;    /*->last symbol chain link. */
   while ((symbolP = *symbolPP) != NULL)
     {
-      if (flagseen['R'] && (S_GET_SEGMENT (symbolP) == SEG_DATA))
+      if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA))
        {
          S_SET_SEGMENT (symbolP, SEG_TEXT);
        }                       /* if pusing data into text */
 
-      resolve_symbol_value (symbolP);
+      resolve_symbol_value (symbolP, 1);
+
+      /* Skip symbols which were equated to undefined or common
+        symbols.  */
+      if (symbolP->sy_value.X_op == O_symbol
+         && (! S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP)))
+       {
+         *symbolPP = symbol_next (symbolP);
+         continue;
+       }
 
       /* OK, here is how we decide which symbols go out into the
         brave new symtab.  Symbols that do are:
@@ -273,7 +290,7 @@ obj_crawl_symbol_chain (headers)
              || !S_IS_DEFINED (symbolP)
              || S_IS_EXTERNAL (symbolP)
 #endif /* TC_I960 */
-             || (S_GET_NAME (symbolP)[0] != '\001' && (flagseen['L'] || !S_LOCAL_NAME (symbolP)))))
+             || (S_GET_NAME (symbolP)[0] != '\001' && (flag_keep_locals || !S_LOCAL_NAME (symbolP)))))
        {
          symbolP->sy_number = symbol_number++;
 
@@ -293,7 +310,7 @@ obj_crawl_symbol_chain (headers)
        {
          if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
            {
-             as_bad ("Local symbol %s never defined", S_GET_NAME (symbolP));
+             as_bad (_("Local symbol %s never defined"), S_GET_NAME (symbolP));
            }                   /* oops. */
 
          /* Unhook it from the chain */
@@ -302,9 +319,7 @@ obj_crawl_symbol_chain (headers)
     }                          /* for each symbol */
 
   H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number);
-
-  return;
-}                              /* obj_crawl_symbol_chain() */
+}
 
 /*
  * Find strings by crawling along symbol table chain.
@@ -329,8 +344,6 @@ obj_emit_strings (where)
       if (S_GET_NAME (symbolP))
        append (where, S_GET_NAME (symbolP), (unsigned long) (strlen (S_GET_NAME (symbolP)) + 1));
     }                          /* walk symbol chain */
-
-  return;
-}                              /* obj_emit_strings() */
+}
 
 /* end of obj-bout.c */
This page took 0.02472 seconds and 4 git commands to generate.