summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-10-18 11:10:53 +1030
committerAlan Modra <amodra@gmail.com>2014-10-28 16:51:11 +1030
commit7cc2a6b6a4c63cba363836475052a71e0387e621 (patch)
treeab426b002a52db70e7e681220bf2df46619497af /gas
parent04253f276b48227728cac3e4c6df614e161f1e9c (diff)
downloadbinutils-7cc2a6b6a4c63cba363836475052a71e0387e621.tar.gz
binutils-7cc2a6b6a4c63cba363836475052a71e0387e621.tar.bz2
binutils-7cc2a6b6a4c63cba363836475052a71e0387e621.zip
Fix PR17493, attempted output of *GAS `reg' section* symbol
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-i386.c2
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/i386/inval-equ-2.l12
-rw-r--r--gas/write.c3
5 files changed, 22 insertions, 8 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index b265f73dd9c..f9dfc8e1561 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,6 +1,13 @@
2014-10-28 Alan Modra <amodra@gmail.com>
Apply trunk patches
+ 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-15 Chen Gang <gang.chen.5i5j@gmail.com>
* config/tc-tic4x.c (md_assemble): Correct strncat size.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 38e97815175..2e34ce3df61 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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);
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 4cbfd068e91..1e9d7efd9e6 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-28 Alan Modra <amodra@gmail.com>
+
+ Apply truck patches
+ 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',
diff --git a/gas/testsuite/gas/i386/inval-equ-2.l b/gas/testsuite/gas/i386/inval-equ-2.l
index eafaf254052..11f5e4ed3e9 100644
--- a/gas/testsuite/gas/i386/inval-equ-2.l
+++ b/gas/testsuite/gas/i386/inval-equ-2.l
@@ -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[ ]+..
diff --git a/gas/write.c b/gas/write.c
index 263b002e3ce..0f82d47931f 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -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. */