aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-11-16 07:21:11 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-11-16 07:34:46 -0800
commitd7e3e627027fcf37d63e284144fe27ff4eba36b5 (patch)
tree2d179da6a560fbb1f9bfe14a2f493e4954e7e889 /gas/config
parent3b2934856f1370b320d8be5e1d4d82ef0c628f01 (diff)
downloadgdb-d7e3e627027fcf37d63e284144fe27ff4eba36b5.zip
gdb-d7e3e627027fcf37d63e284144fe27ff4eba36b5.tar.gz
gdb-d7e3e627027fcf37d63e284144fe27ff4eba36b5.tar.bz2
x86: Don't allow KMOV in TLS code sequences
Don't allow KMOV in TLS code sequences which require integer MOV instructions. PR target/28595 * config/tc-i386.c (match_template): Don't allow KMOV in TLS code sequences. * testsuite/gas/i386/i386.exp: Run inval-tls and x86-64-inval-tls tests. * testsuite/gas/i386/inval-tls.l: New file. * testsuite/gas/i386/inval-tls.s: Likewise. * testsuite/gas/i386/x86-64-inval-tls.l: Likewise. * testsuite/gas/i386/x86-64-inval-tls.s: Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 320ea7e..9674ec4 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -6639,11 +6639,25 @@ match_template (char mnem_suffix)
}
}
- /* Force 0x8b encoding for "mov foo@GOT, %eax". */
- if (i.reloc[0] == BFD_RELOC_386_GOT32
- && t->base_opcode == 0xa0
- && t->opcode_modifier.opcodespace == SPACE_BASE)
- continue;
+ switch (i.reloc[0])
+ {
+ case BFD_RELOC_386_GOT32:
+ /* Force 0x8b encoding for "mov foo@GOT, %eax". */
+ if (t->base_opcode == 0xa0
+ && t->opcode_modifier.opcodespace == SPACE_BASE)
+ continue;
+ break;
+ case BFD_RELOC_386_TLS_GOTIE:
+ case BFD_RELOC_386_TLS_LE_32:
+ case BFD_RELOC_X86_64_GOTTPOFF:
+ case BFD_RELOC_X86_64_TLSLD:
+ /* Don't allow KMOV in TLS code sequences. */
+ if (t->opcode_modifier.vex)
+ continue;
+ break;
+ default:
+ break;
+ }
/* We check register size if needed. */
if (t->opcode_modifier.checkregsize)