gas/
authorJan Beulich <jbeulich@novell.com>
Thu, 27 Oct 2005 07:40:07 +0000 (07:40 +0000)
committerJan Beulich <jbeulich@novell.com>
Thu, 27 Oct 2005 07:40:07 +0000 (07:40 +0000)
2005-10-27  Jan Beulich  <jbeulich@novell.com>

* read.c (assign_symbol): Also consider equates already defined.
* symbols.c (symbol_clone): Also clone the underlying BFD symbol.
* config/obj-coff.h (obj_symbol_clone_hook): New.
(coff_obj_symbol_clone_hook): Declare.
* config/obj-coff.c (coff_obj_symbol_clone_hook): New.

gas/testsuite/
2005-10-27  Jan Beulich  <jbeulich@novell.com>

* gas/all/gas.exp: Don't xfail equiv1 test anymore.

gas/ChangeLog
gas/config/obj-coff.c
gas/config/obj-coff.h
gas/read.c
gas/symbols.c
gas/testsuite/ChangeLog
gas/testsuite/gas/all/gas.exp

index 488cbcb4b86b8737c9706b4eee272bc5718f17f5..a4fcec42927bb63bb38113b0ac0f12934ee257fc 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-27  Jan Beulich  <jbeulich@novell.com>
+
+       * read.c (assign_symbol): Also consider equates already defined.
+       * symbols.c (symbol_clone): Also clone the underlying BFD symbol.
+       * config/obj-coff.h (obj_symbol_clone_hook): New.
+       (coff_obj_symbol_clone_hook): Declare.
+       * config/obj-coff.c (coff_obj_symbol_clone_hook): New.
+
 2005-10-26  DJ Delorie  <dj@redhat.com>
 
        * config/tc-m32c.c (md_relax_table, subtype_mappings,
index f1446c023485a32c1109155a639e3973932ab48b..ce4d6f5fcc7866e7066e7b90668b67b2587c61e9 100644 (file)
@@ -329,6 +329,18 @@ coff_obj_symbol_new_hook (symbolS *symbolP)
     SF_SET_LOCAL (symbolP);
 }
 
+void
+coff_obj_symbol_clone_hook (symbolS *newsymP, symbolS *orgsymP)
+{
+  long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
+  combined_entry_type * s = xmalloc (sz);
+
+  memcpy (s, coffsymbol (symbol_get_bfdsym (orgsymP))->native, sz);
+  coffsymbol (symbol_get_bfdsym (newsymP))->native = s;
+
+  SF_SET (newsymP, SF_GET (orgsymP));
+}
+
 \f
 /* Handle .ln directives.  */
 
index 4c7c68d77a782e3b49079ddea6571e5bbcbf8afd..6fcbc9f06cbbdf088a1c408bdba0e5546f3ab979 100644 (file)
 #endif
 
 #define obj_symbol_new_hook coff_obj_symbol_new_hook
+#define obj_symbol_clone_hook coff_obj_symbol_clone_hook
 #define obj_read_begin_hook coff_obj_read_begin_hook
 
 #include "bfd/libcoff.h"
@@ -391,6 +392,7 @@ extern void coff_frob_section            (segT);
 extern void coff_adjust_section_syms     (bfd *, asection *, void *);
 extern void coff_frob_file_after_relocs  (void);
 extern void coff_obj_symbol_new_hook     (symbolS *);
+extern void coff_obj_symbol_clone_hook   (symbolS *, symbolS *);
 extern void coff_obj_read_begin_hook     (void);
 #ifdef TE_PE
 extern void pecoff_obj_set_weak_hook     (symbolS *);
index 9381735e8ddb074b8f0d1a075eb10a6f9cfbfc0d..c85ca5fac5d0c7649088f48f26ce7bcec6f3c7e4 100644 (file)
@@ -2794,7 +2794,7 @@ assign_symbol (char *name, int mode)
 #endif
     }
 
-  if (S_IS_DEFINED (symbolP))
+  if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
     {
       /* Permit register names to be redefined.  */
       if ((mode != 0 || !S_IS_VOLATILE (symbolP))
index 0110f4204d9bfdf219aaa7c0d33062644c111f8b..c42cd7c03ca56269de3f65486cd7cd4738d59c6c 100644 (file)
@@ -542,6 +542,7 @@ symbolS *
 symbol_clone (symbolS *orgsymP, int replace)
 {
   symbolS *newsymP;
+  asymbol *bsymorg, *bsymnew;
 
   /* Running local_symbol_convert on a clone that's not the one currently
      in local_hash would incorrectly replace the hash entry.  Thus the
@@ -549,11 +550,30 @@ symbol_clone (symbolS *orgsymP, int replace)
      depends on not encountering an unconverted symbol.  */
   if (LOCAL_SYMBOL_CHECK (orgsymP))
     orgsymP = local_symbol_convert ((struct local_symbol *) orgsymP);
+  bsymorg = orgsymP->bsym;
 
   know (S_IS_DEFINED (orgsymP));
 
   newsymP = obstack_alloc (&notes, sizeof (*newsymP));
   *newsymP = *orgsymP;
+  bsymnew = bfd_make_empty_symbol (bfd_asymbol_bfd (bsymorg));
+  if (bsymnew == NULL)
+    as_perror ("%s", "bfd_make_empty_symbol");
+  newsymP->bsym = bsymnew;
+  bsymnew->name = bsymorg->name;
+  bsymnew->flags =  bsymorg->flags;
+  bsymnew->section =  bsymorg->section;
+  bsymnew->udata.p = (PTR) newsymP;
+  bfd_copy_private_symbol_data (bfd_asymbol_bfd (bsymorg), bsymorg,
+                               bfd_asymbol_bfd (bsymnew), bsymnew);
+
+#ifdef obj_symbol_clone_hook
+  obj_symbol_clone_hook (newsymP, orgsymP);
+#endif
+
+#ifdef tc_symbol_clone_hook
+  tc_symbol_clone_hook (newsymP, orgsymP);
+#endif
 
   if (replace)
     {
index 127e6a76eb1ee8b5d554d83dee47cb61c014656d..821653da8d2d6f9e2710daeec88164c0e9d2a9b9 100644 (file)
@@ -1,3 +1,7 @@
+2005-10-27  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/all/gas.exp: Don't xfail equiv1 test anymore.
+
 2005-10-26  Paul Brook  <paul@codesourcery.com>
 
        * gas/arm/archv6.d: Adjust expected output.
index 5c52e9e3d7f1b2437f46dd4c4f6e7ff96a0d73be..b67b23791c78033e3cecba5970b9011fcb1b4313 100644 (file)
@@ -35,8 +35,6 @@ if ![istarget hppa*-*-*] then {
     gas_test_error "diff1.s" "" "difference of two undefined symbols"
 }
 
-# PR/1387
-setup_xfail "*-*-*"
 gas_test_error "equiv1.s" "" ".equiv for symbol already set to another one"
 gas_test_error "equiv2.s" "" ".equiv for symbol already set to an expression"