]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas/
authorJan Beulich <jbeulich@novell.com>
Wed, 15 Nov 2006 15:59:26 +0000 (15:59 +0000)
committerJan Beulich <jbeulich@novell.com>
Wed, 15 Nov 2006 15:59:26 +0000 (15:59 +0000)
2006-11-15  Jan Beulich  <jbeulich@novell.com>

PR/3469
* symbols.c (symbol_clone): Mark symbol ending up not on symbol
chain by linking it to itself.
(resolve_symbol_value): Also check symbol_shadow_p().
(symbol_shadow_p): New.
* symbols.h (symbol_shadow_p): Declare.

gas/testsuite/
2006-11-15  Jan Beulich  <jbeulich@novell.com>

* gas/elf/equ-reloc.[sd]: New.
* gas/elf/elf.exp: Run new test.

gas/ChangeLog
gas/symbols.c
gas/symbols.h
gas/testsuite/ChangeLog
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/equ-reloc.d [new file with mode: 0644]
gas/testsuite/gas/elf/equ-reloc.s [new file with mode: 0644]

index 18ae9937f745be84df3ed08f357b15f25ec8f206..1afffe1089ecfdaa4234924faebebcdce0e27187 100644 (file)
@@ -1,3 +1,12 @@
+2006-11-15  Jan Beulich  <jbeulich@novell.com>
+
+       PR/3469
+       * symbols.c (symbol_clone): Mark symbol ending up not on symbol
+       chain by linking it to itself.
+       (resolve_symbol_value): Also check symbol_shadow_p().
+       (symbol_shadow_p): New.
+       * symbols.h (symbol_shadow_p): Declare.
+
 2006-11-12  Mark Shinwell  <shinwell@codesourcery.com>
 
        * config/tc-arm.c (do_t_czb): Rename to do_t_cbz.
index dccc46af9239df127ff8edfd742800d296c527c7..6a90bba219de40c64d111ab6202722548e81ce92 100644 (file)
@@ -598,11 +598,13 @@ symbol_clone (symbolS *orgsymP, int replace)
        symbol_lastP = newsymP;
       else if (orgsymP->sy_next)
        orgsymP->sy_next->sy_previous = newsymP;
-      orgsymP->sy_next = NULL;
+      orgsymP->sy_previous = orgsymP->sy_next = orgsymP;
       debug_verify_symchain (symbol_rootP, symbol_lastP);
 
       symbol_table_insert (newsymP);
     }
+  else
+    newsymP->sy_previous = newsymP->sy_next = newsymP;
 
   return newsymP;
 }
@@ -1078,8 +1080,9 @@ resolve_symbol_value (symbolS *symp)
              symp->sy_resolving = 0;
              goto exit_dont_set_value;
            }
-         else if (finalize_syms && final_seg == expr_section
-                  && seg_left != expr_section)
+         else if (finalize_syms &&
+                  ((final_seg == expr_section && seg_left != expr_section) ||
+                   symbol_shadow_p (symp)))
            {
              /* If the symbol is an expression symbol, do similarly
                 as for undefined and common syms above.  Handles
@@ -2492,6 +2495,17 @@ symbol_constant_p (symbolS *s)
   return s->sy_value.X_op == O_constant;
 }
 
+/* Return whether a symbol was cloned and thus removed from the global
+   symbol list.  */
+
+int
+symbol_shadow_p (symbolS *s)
+{
+  if (LOCAL_SYMBOL_CHECK (s))
+    return 0;
+  return s->sy_next == s;
+}
+
 /* Return the BFD symbol for a symbol.  */
 
 asymbol *
index 7a4b8f7a6da30599beb4631dc3d890e9339fcf5d..0527abbb91d3ddb69cb3a6a2d9c13b21a1ceb841 100644 (file)
@@ -192,6 +192,7 @@ extern int symbol_section_p (symbolS *);
 extern int symbol_equated_p (symbolS *);
 extern int symbol_equated_reloc_p (symbolS *);
 extern int symbol_constant_p (symbolS *);
+extern int symbol_shadow_p (symbolS *);
 extern asymbol *symbol_get_bfdsym (symbolS *);
 extern void symbol_set_bfdsym (symbolS *, asymbol *);
 
index 43705a34c4093db74dbf88138ccaf7bcc88f580d..dce5cb49853a2fff89aa66e106dc212f5393addb 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-15  Jan Beulich  <jbeulich@novell.com>
+
+       * gas/elf/equ-reloc.[sd]: New.
+       * gas/elf/elf.exp: Run new test.
+
 2006-11-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gas/i386/merom.d: Use "#pass" instead of "#..." to skip the
index 2acecbffb10f4dc10b365cf0794158adf370ff7a..67ccc5b4eb9a915b46a73385e450f782f82a839b 100644 (file)
@@ -72,6 +72,7 @@ if { ([istarget "*-*-*elf*"]
        { *c54x*-*-* } { }
        default {
            run_dump_test redef
+           run_dump_test equ-reloc
        }
     }
     run_dump_test "section0" 
diff --git a/gas/testsuite/gas/elf/equ-reloc.d b/gas/testsuite/gas/elf/equ-reloc.d
new file mode 100644 (file)
index 0000000..e4e7d47
--- /dev/null
@@ -0,0 +1,13 @@
+#objdump: -rsj .data
+#name: elf equate relocs
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[.*\]:
+OFFSET *TYPE *VALUE 
+0*0 [^ ]+ +(\.bss(\+0x0*4)?|y1)
+0*4 [^ ]+ +(\.bss(\+0x0*8)?|y2)
+#...
+Contents of section .data:
+ 0000 0[04]00000[04] 0[08]00000[08].*
+#pass
diff --git a/gas/testsuite/gas/elf/equ-reloc.s b/gas/testsuite/gas/elf/equ-reloc.s
new file mode 100644 (file)
index 0000000..efdd0e1
--- /dev/null
@@ -0,0 +1,16 @@
+       .data
+       .long x1, x2
+
+       .global x1, x2, z2
+
+       .set x1, y1
+       .set x2, y2
+       .set x2, z2
+
+       .section .bss, "aw", %nobits
+x1:
+       .zero   4
+y1:
+       .zero   4
+y2:
+       .zero   4