From f2810fe00a6b5f227c6d64168127f184f9862a19 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 27 Dec 2019 09:39:58 +0100 Subject: [PATCH] x86: adjust ignored prefix warning for branches There's no reason to not also issue them in Intel syntax mode, and it can be quite helpful to mention the actual insn (after all there can be multiple on a single line). --- gas/ChangeLog | 9 +++++++++ gas/config/tc-i386.c | 12 ++++++------ gas/testsuite/gas/i386/mpx-inval-1.l | 12 ++++++++---- gas/testsuite/gas/i386/notrackbad.l | 4 ++-- gas/testsuite/gas/i386/x86-64-notrackbad.l | 4 ++-- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 286f018747b..dc028c9f055 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2019-12-27 Jan Beulich + + * config/tc-i386.c (output_branch, output_jump, + output_interseg_jump): Also emit skipped prefix warning in Intel + syntax mode. Name instruction in the warning text. + * testsuite/gas/i386/mpx-inval-1.l, + testsuite/gas/i386/notrackbad.l, + testsuite/gas/i386/x86-64-notrackbad.l: Adjust expectations. + 2019-12-27 Jan Beulich * config/tc-i386.c (output_branch): Handle BND prefix the same diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 8e89b00f8d1..a78aaba6cda 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -7914,8 +7914,8 @@ output_branch (void) i.prefixes--; } - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); + if (i.prefixes != 0) + as_warn (_("skipping prefixes on `%s'"), i.tm.name); /* It's always a symbol; End frag & setup for relax. Make sure there is enough room in this frag for the largest @@ -8057,8 +8057,8 @@ output_jump (void) i.prefixes -= 1; } - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); + if (i.prefixes != 0) + as_warn (_("skipping prefixes on `%s'"), i.tm.name); p = frag_more (i.tm.opcode_length + size); switch (i.tm.opcode_length) @@ -8118,8 +8118,8 @@ output_interseg_jump (void) if (code16) size = 2; - if (i.prefixes != 0 && !intel_syntax) - as_warn (_("skipping prefixes on this instruction")); + if (i.prefixes != 0) + as_warn (_("skipping prefixes on `%s'"), i.tm.name); /* 1 opcode; 2 segment; offset */ p = frag_more (prefix + 1 + 2 + size); diff --git a/gas/testsuite/gas/i386/mpx-inval-1.l b/gas/testsuite/gas/i386/mpx-inval-1.l index b356080cd53..f50fd7f06ca 100644 --- a/gas/testsuite/gas/i386/mpx-inval-1.l +++ b/gas/testsuite/gas/i386/mpx-inval-1.l @@ -2,15 +2,17 @@ .*:6: Error: expecting valid branch instruction after `bnd' .*:7: Error: expecting valid branch instruction after `bnd' .*:8: Error: expecting valid branch instruction after `bnd' -.*:8: Warning: skipping prefixes on this instruction +.*:8: Warning: skipping prefixes on `lcall' .*:9: Error: expecting valid branch instruction after `bnd' -.*:9: Warning: skipping prefixes on this instruction +.*:9: Warning: skipping prefixes on `ljmp' .*:10: Error: expecting valid branch instruction after `bnd' .*:11: Error: expecting valid branch instruction after `bnd' .*:14: Error: expecting valid branch instruction after `bnd' .*:15: Error: expecting valid branch instruction after `bnd' .*:16: Error: expecting valid branch instruction after `bnd' +.*:16: Warning: skipping prefixes on `lcall' .*:17: Error: expecting valid branch instruction after `bnd' +.*:17: Warning: skipping prefixes on `ljmp' .*:18: Error: expecting valid branch instruction after `bnd' .*:19: Error: expecting valid branch instruction after `bnd' GAS LISTING .* @@ -27,11 +29,11 @@ GAS LISTING .* .* Error: expecting valid branch instruction after `bnd' [ ]*8[ ]+\?\?\?\? 9A000000 bnd lcall \$0x1234,\$xxx .* Error: expecting valid branch instruction after `bnd' -.* Warning: skipping prefixes on this instruction +.* Warning: skipping prefixes on `lcall' [ ]*8[ ]+003412 [ ]*9[ ]+\?\?\?\? EA000000 bnd ljmp \$0x1234,\$xxx .* Error: expecting valid branch instruction after `bnd' -.* Warning: skipping prefixes on this instruction +.* Warning: skipping prefixes on `ljmp' [ ]*9[ ]+003412 [ ]*10[ ]+\?\?\?\? F2E2E9 bnd loop foo .* Error: expecting valid branch instruction after `bnd' @@ -45,9 +47,11 @@ GAS LISTING .* .* Error: expecting valid branch instruction after `bnd' [ ]*16[ ]+\?\?\?\? 9A000000 bnd lcall 0x1234,xxx .* Error: expecting valid branch instruction after `bnd' +.* Warning: skipping prefixes on `lcall' [ ]*16[ ]+003412 [ ]*17[ ]+\?\?\?\? EA000000 bnd ljmp 0x1234,xxx .* Error: expecting valid branch instruction after `bnd' +.* Warning: skipping prefixes on `ljmp' [ ]*17[ ]+003412 [ ]*18[ ]+\?\?\?\? F2E2CE bnd loop foo .* Error: expecting valid branch instruction after `bnd' diff --git a/gas/testsuite/gas/i386/notrackbad.l b/gas/testsuite/gas/i386/notrackbad.l index 2271a92bf6a..75d55536ee1 100644 --- a/gas/testsuite/gas/i386/notrackbad.l +++ b/gas/testsuite/gas/i386/notrackbad.l @@ -1,6 +1,6 @@ .*: Assembler messages: .*:6: Error: expecting indirect branch instruction after `notrack' -.*:6: Warning: skipping prefixes on this instruction +.*:6: Warning: skipping prefixes on `call' .*:7: Error: expecting indirect branch instruction after `notrack' .*:9: Error: same type of prefix used twice .*:10: Error: same type of prefix used twice @@ -16,7 +16,7 @@ GAS LISTING .* [ ]*5[ ]+_start: [ ]*6[ ]+\?\?\?\? [0-9A-F]* notrack call foo \*\*\*\* Error: expecting indirect branch instruction after `notrack' -\*\*\*\* Warning: skipping prefixes on this instruction +\*\*\*\* Warning: skipping prefixes on `call' [ ]*6[ ]+[0-9A-F]* [ ]*7[ ]+\?\?\?\? [0-9A-F]* notrack jmp foo \*\*\*\* Error: expecting indirect branch instruction after `notrack' diff --git a/gas/testsuite/gas/i386/x86-64-notrackbad.l b/gas/testsuite/gas/i386/x86-64-notrackbad.l index 95a0f91ce10..173b3d1508c 100644 --- a/gas/testsuite/gas/i386/x86-64-notrackbad.l +++ b/gas/testsuite/gas/i386/x86-64-notrackbad.l @@ -1,6 +1,6 @@ .*: Assembler messages: .*:6: Error: expecting indirect branch instruction after `notrack' -.*:6: Warning: skipping prefixes on this instruction +.*:6: Warning: skipping prefixes on `call' .*:7: Error: expecting indirect branch instruction after `notrack' .*:9: Error: same type of prefix used twice .*:10: Error: same type of prefix used twice @@ -16,7 +16,7 @@ GAS LISTING .* [ ]*5[ ]+_start: [ ]*6[ ]+\?\?\?\? [0-9A-F]* notrack call foo \*\*\*\* Error: expecting indirect branch instruction after `notrack' -\*\*\*\* Warning: skipping prefixes on this instruction +\*\*\*\* Warning: skipping prefixes on `call' [ ]*6[ ]+[0-9A-F]* [ ]*7[ ]+\?\?\?\? [0-9A-F]* notrack jmp foo \*\*\*\* Error: expecting indirect branch instruction after `notrack' -- 2.30.2