x86: Update segment register check in Intel syntax
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 1 Aug 2017 12:53:27 +0000 (05:53 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 1 Aug 2017 12:53:27 +0000 (05:53 -0700)
commit4d36230d59903b92fbe2b53b31ed64a884860f0e
tree0388c320864b813881a45b19fd804308ccf797af
parent60c4393c5085dcae64c84a51590f8a98199f9221
x86: Update segment register check in Intel syntax

https://sourceware.org/ml/binutils/2009-04/msg00223.html

introduced a new Intel syntax parser which accepts

mov eax, fs:gs:[eax]

It ignores anything between ':'s after fs and treats

mov eax, DWORD PTR fs:foobar:16
mov eax, DWORD PTR fs:foobar:barfoo:16
mov eax, DWORD PTR fs:ds:16
mov eax, DWORD PTR fs:ds:cs:16

as

mov eax, DWORD PTR fs:16

This patch updates segment register check and only allows a single ':'.

PR gas/21874
* config/tc-i386-intel.c (i386_intel_operand): Update segment
register check.
* testsuite/gas/i386/intelok.s: Replace "fs:gs:[eax]" with
"fs:[eax]".
* testsuite/gas/i386/inval-seg.s: Add tests for invalid segment
register.
* testsuite/gas/i386/x86-64-inval-seg.s: Likewise.
* testsuite/gas/i386/inval-seg.l: Updated.
* testsuite/gas/i386/x86-64-inval-seg.l: Likewise.
gas/ChangeLog
gas/config/tc-i386-intel.c
gas/testsuite/gas/i386/intelok.s
gas/testsuite/gas/i386/inval-seg.l
gas/testsuite/gas/i386/inval-seg.s
gas/testsuite/gas/i386/x86-64-inval-seg.l
gas/testsuite/gas/i386/x86-64-inval-seg.s