Bug 25516 - gas no longer accepts sysenter/sysexit with no -m flag.
Summary: gas no longer accepts sysenter/sysexit with no -m flag.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.35
Assignee: Not yet assigned to anyone
URL: https://sourceware.org/ml/binutils/20...
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-07 11:37 UTC by andy
Modified: 2020-02-10 16:53 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2020-02-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andy 2020-02-07 11:37:47 UTC
Since upgrading to binutils 2.34, gas will no longer assemble a file in 64-bit mode which contains sysenter/sysexit instructions. I understand that these are not available in 64-bit mode on AMD, but the documentation says that it will accept both ISAs unless specifically told otherwise via a flag:

       -mamd64
       -mintel64
           This option specifies that the assembler should accept only AMD64
           or Intel64 ISA in 64-bit mode.  The default is to accept both.


% cat l.s
.text
sysenter


% gas -v l.s
GNU assembler version 2.34 (x86_64-pc-solaris2.11) using BFD version (GNU Binutils) 2.34
l.s: Assembler messages:
l.s:2: Error: unsupported instruction `sysenter'

% gas -mintel64 l.s
%

% gas -mamd64 l.s
l.s: Assembler messages:
l.s:2: Error: unsupported instruction `sysenter'


Expected results:

gas should produce the error only with -mamd64 and not with -mintel64 and not without a specific target ISA parameter.
Comment 1 John Levon 2020-02-07 11:42:05 UTC
Just a little bit of context: this is a kernel asm file, and is correct as the sysexit is never executed under AMD in 64-bit
Comment 2 H.J. Lu 2020-02-07 20:35:47 UTC
A patch is posted at

https://sourceware.org/ml/binutils/2020-02/msg00118.html
Comment 3 cvs-commit@gcc.gnu.org 2020-02-10 16:39:33 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4b5aaf5f6992319c2c72e080a1a55842640b8732

commit 4b5aaf5f6992319c2c72e080a1a55842640b8732
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 10 08:37:22 2020 -0800

    x86: Accept Intel64 only instruction by default
    
    Commit d835a58baae720 disabled sysenter/sysenter in 64-bit mode by
    default.  By default, assembler should accept common, Intel64 only
    and AMD64 ISAs since there are no conflicts.
    
    gas/
    
    	PR gas/25516
    	* config/tc-i386.c (intel64): Renamed to ...
    	(isa64): This.
    	(match_template): Accept Intel64 only instruction by default.
    	(i386_displacement): Updated.
    	(md_parse_option): Updated.
    	* c-i386.texi: Update -mamd64/-mintel64 documentation.
    	* testsuite/gas/i386/i386.exp: Run x86-64-sysenter.  Pass
    	-mamd64 to x86-64-sysenter-amd.
    	* testsuite/gas/i386/x86-64-sysenter.d: New file.
    
    opcodes/
    
    	PR gas/25516
    	* i386-gen.c (opcode_modifiers): Replace AMD64 and Intel64
    	with ISA64.
    	* i386-opc.h (AMD64): Removed.
    	(Intel64): Likewose.
    	(AMD64): New.
    	(INTEL64): Likewise.
    	(INTEL64ONLY): Likewise.
    	(i386_opcode_modifier): Replace amd64 and intel64 with isa64.
    	* i386-opc.tbl (Amd64): New.
    	(Intel64): Likewise.
    	(Intel64Only): Likewise.
    	Replace AMD64 with Amd64.  Update sysenter/sysenter with
    	Cpu64 and Intel64Only.  Remove AMD64 from sysenter/sysenter.
    	* i386-tbl.h: Regenerated.
Comment 4 cvs-commit@gcc.gnu.org 2020-02-10 16:53:23 UTC
The binutils-2_34-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=924adcb1d4836a08b254404350220b67332e7647

commit 924adcb1d4836a08b254404350220b67332e7647
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Feb 10 08:37:22 2020 -0800

    x86: Accept Intel64 only instruction by default
    
    Commit d835a58baae720 disabled sysenter/sysenter in 64-bit mode by
    default.  By default, assembler should accept common, Intel64 only
    and AMD64 ISAs since there are no conflicts.
    
    gas/
    
    	PR gas/25516
    	* config/tc-i386.c (intel64): Renamed to ...
    	(isa64): This.
    	(match_template): Accept Intel64 only instruction by default.
    	(i386_displacement): Updated.
    	(md_parse_option): Updated.
    	* c-i386.texi: Update -mamd64/-mintel64 documentation.
    	* testsuite/gas/i386/i386.exp: Run x86-64-sysenter.  Pass
    	-mamd64 to x86-64-sysenter-amd.
    	* testsuite/gas/i386/x86-64-sysenter.d: New file.
    
    opcodes/
    
    	PR gas/25516
    	* i386-gen.c (opcode_modifiers): Replace AMD64 and Intel64
    	with ISA64.
    	* i386-opc.h (AMD64): Removed.
    	(Intel64): Likewose.
    	(AMD64): New.
    	(INTEL64): Likewise.
    	(INTEL64ONLY): Likewise.
    	(i386_opcode_modifier): Replace amd64 and intel64 with isa64.
    	* i386-opc.tbl (Amd64): New.
    	(Intel64): Likewise.
    	(Intel64Only): Likewise.
    	Replace AMD64 with Amd64.  Update sysenter/sysenter with
    	Cpu64 and Intel64Only.  Remove AMD64 from sysenter/sysenter.
    	* i386-tbl.h: Regenerated.
    
    (cherry picked from commit 4b5aaf5f6992319c2c72e080a1a55842640b8732)
Comment 5 H.J. Lu 2020-02-10 16:53:34 UTC
Fixed for 2.35 and 2.34 branch.