Fix PR17493, attempted output of *GAS `reg' section* symbol
authorAlan Modra <amodra@gmail.com>
Sat, 18 Oct 2014 00:40:53 +0000 (11:10 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 18 Oct 2014 12:37:07 +0000 (23:07 +1030)
The write.c change is to make gas report an error if reg_section
symbols should leak in future.  The tc-i386.c change is the real fix.

Note that the error isn't the most helpful, "redefined symbol cannot
be used on reloc", but I'm not inclined to improve what is really an
internal gas error.  reg_section symbols shouldn't leak..

gas/
PR 17493
* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
to be reduced to reg_section section symbol.
* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
reg_section immediates.
gas/testsuite/
* gas/i386/inval-equ-2.l: Adjust.

gas/ChangeLog
gas/config/tc-i386.c
gas/testsuite/ChangeLog
gas/testsuite/gas/i386/inval-equ-2.l
gas/write.c

index 0ad7a54cca2fcdd4bfe07f5918195aa81a345558..56542cda8e0bd1ce5f89fb87c078962dc951e07b 100644 (file)
@@ -1,3 +1,11 @@
+2014-10-18  Alan Modra  <amodra@gmail.com>
+
+       PR 17493
+       * write.c (adjust_reloc_syms): Don't allow symbols in reg_section
+       to be reduced to reg_section section symbol.
+       * gas/config/tc-i386.c (i386_finalize_immediate): Reject all
+       reg_section immediates.
+
 2014-10-17  Matthew Fortune  <matthew.fortune@imgtec.com>
 
        * doc/c-mips.texi: Fix bad @value references.
index 38e978151756ff2a080c50dbc792c03709046155..2e34ce3df6143247ea3e9227952582e6e6a6210d 100644 (file)
@@ -7985,7 +7985,7 @@ i386_finalize_immediate (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp,
       return 0;
     }
 #endif
-  else if (!intel_syntax && exp->X_op == O_register)
+  else if (!intel_syntax && exp_seg == reg_section)
     {
       if (imm_start)
        as_bad (_("illegal immediate register operand %s"), imm_start);
index 4cbfd068e913e5be00c0784cdd3c7d3d8ddffeee..396d5ab863e509497e56b6ff201ca82a0d89bde6 100644 (file)
@@ -1,3 +1,7 @@
+2014-10-18  Alan Modra  <amodra@gmail.com>
+
+       * gas/i386/inval-equ-2.l: Adjust.
+
 2014-10-09  Jose E. Marchesi  <jose.marchesi@oracle.com>
 
        * gas/sparc/hpcvis3.d: Remove tests for the `chkpt', `commit',
index eafaf2540527b96f0c20d236580afe712cd83e00..11f5e4ed3e9dba4a39c406d7739ef634ea462348 100644 (file)
@@ -7,15 +7,15 @@ GAS LISTING .*
 
 [      ]*1[    ]+\.globl  bar1
 [      ]*2[    ]+\.set    bar1,\(%eax\+1\)
-[      ]*3[    ]+\?\?\?\? A12A0000             mov bar1,%eax
-[      ]*3[    ]+00
+[      ]*3[    ]+\?\?\?\? A1......             mov bar1,%eax
+[      ]*3[    ]+..
 [      ]*4[    ]+\.set    bar2,\(%eax\+1\)
-[      ]*5[    ]+\?\?\?\? A12A0000             mov bar2,%eax
-[      ]*5[    ]+00
+[      ]*5[    ]+\?\?\?\? A1......             mov bar2,%eax
+[      ]*5[    ]+..
 [      ]*6[    ]+\.globl  bar2
 [      ]*7[    ]+\.set    bar3,\(%eax\+1\)
-[      ]*8[    ]+\?\?\?\? A12A0000             mov bar3,%eax
+[      ]*8[    ]+\?\?\?\? A1......             mov bar3,%eax
 .*  Error: can't make global register symbol `bar1'
 .*  Error: can't make global register symbol `bar2'
 .*  Error: can't make global register symbol `bar3'
-[      ]*8[    ]+00
+[      ]*8[    ]+..
index 263b002e3ce9990f24863cd53f94572c405e467a..0f82d47931f4dcec519ee3139612db4e78d94cec 100644 (file)
@@ -836,7 +836,8 @@ adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED,
        if (symsec == NULL)
          abort ();
 
-       if (bfd_is_abs_section (symsec))
+       if (bfd_is_abs_section (symsec)
+           || symsec == reg_section)
          {
            /* The fixup_segment routine normally will not use this
               symbol in a relocation.  */
This page took 0.034366 seconds and 4 git commands to generate.