From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46378 invoked by alias); 14 Feb 2020 11:43:34 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 46370 invoked by uid 89); 14 Feb 2020 11:43:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:sk:1fc51e5, H*i:sk:1fc51e5, H*f:sk:1fc51e5 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Feb 2020 11:43:33 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4782EADF1; Fri, 14 Feb 2020 11:43:31 +0000 (UTC) Subject: [PATCH v2 1/4] x86: extend LEA's segment override warning From: Jan Beulich To: "binutils@sourceware.org" Cc: "H.J. Lu" References: <1fc51e5f-f2d6-67d5-a034-11b32a1e750f@suse.com> Message-ID: <21d1d85b-d591-bcc5-9ae9-eea0901997fb@suse.com> Date: Fri, 14 Feb 2020 11:43:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <1fc51e5f-f2d6-67d5-a034-11b32a1e750f@suse.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00319.txt.bz2 For one both possible forms should be warned about. And then, to guard against future surprises, qualify the original opcode check by excluding VEX/EVEX-like templates. gas/ 2020-02-XX Jan Beulich * config/tc-i386.c (process_operands): Also check insn prefix for ineffectual segment override warning. Don't cover possible VEX/EVEX encoded insns there. * testsuite/gas/i386/lea.s, testsuite/gas/i386/lea.d, testsuite/gas/i386/lea.e: New. * testsuite/gas/i386/i386.exp: Run new test. --- v2: Move controversial MPX part to separate patch. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -7194,9 +7194,10 @@ duplicate: } } - if (i.tm.base_opcode == 0x8d /* lea */ - && i.seg[0] - && !quiet_warnings) + if ((i.seg[0] || i.prefix[SEG_PREFIX]) + && !quiet_warnings + && i.tm.base_opcode == 0x8d /* lea */ + && !is_any_vex_encoding(&i.tm)) as_warn (_("segment override on `%s' is ineffectual"), i.tm.name); /* If a segment was explicitly specified, and the specified segment --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -65,6 +65,7 @@ if [expr ([istarget "i*86-*-*"] || [ist run_dump_test "intelok" run_dump_test "prefix" run_list_test "prefix32" "-al" + run_dump_test "lea" run_dump_test "amd" run_dump_test "katmai" run_dump_test "jump" --- /dev/null +++ b/gas/testsuite/gas/i386/lea.d @@ -0,0 +1,12 @@ +#objdump: -dw +#name: i386 LEA-like warnings +#warning_output: lea.e + +.*: +file format .* + +Disassembly of section .text: + +0+ : +[ ]*[0-9a-f]+:[ ]+36 8d 00[ ]+lea[ ]+%ss:\(%eax\),%eax +[ ]*[0-9a-f]+:[ ]+36 8d 00[ ]+lea[ ]+%ss:\(%eax\),%eax +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/lea.e @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:3: Warning: .* `lea' .* +.*:4: Warning: .* `lea' .* --- /dev/null +++ b/gas/testsuite/gas/i386/lea.s @@ -0,0 +1,4 @@ + .text +start: + lea %ss:(%eax), %eax + ss lea (%eax), %eax