https://sourceware.org/bugzilla/show_bug.cgi?id=23412
Bug ID: 23412 Summary: .intel_syntax noprefix vs -msyntax=intel -mnaked-reg segment override inconsistency Product: binutils Version: 2.30 Status: UNCONFIRMED Severity: normal Priority: P2 Component: gas Assignee: unassigned at sourceware dot org Reporter: jesse at eclypsium dot com Target Milestone: --- When using -msyntax=intel, as incorrectly parses instructions using segment overrides. # objdump -D -b binary -m i386 -M x86-64 -M intel test.bin test.bin: file format binary Disassembly of section .data: 00000000 <.data>: 0: 2e 48 8b 04 25 44 33 mov rax,QWORD PTR cs:0x11223344 7: 22 11 If I try to assemble this instruction using -msyntax=intel -mnaked-reg command line arguments, as parses this instruction incorrectly and I can't find a variation that it will accept. # cat test-cmd-args.s mov rax, QWORD PTR cs:0x11223344 mov rax, cs:0x11223344 mov rax, cs:[0x11223344] mov rax, [cs:0x11223344] # as -msyntax=intel -mnaked-reg test-cmd-args.s test-cmd-args.s: Assembler messages: test-cmd-args.s:1: Error: invalid use of register test-cmd-args.s:2: Error: junk `:0x11223344' after expression test-cmd-args.s:3: Error: junk `:[0x11223344]' after expression test-cmd-args.s:4: Error: bad expression test-cmd-args.s:4: Error: junk `cs:0x11223344]' after expression However, if I use ".intel_syntax noprefix" in the source file, all variations are assembled correctly. # cat test-inline.s .intel_syntax noprefix mov rax, QWORD PTR cs:0x11223344 mov rax, cs:0x11223344 mov rax, cs:[0x11223344] mov rax, [cs:0x11223344] # as -msyntax=intel -mnaked-reg test-inline.s # objdump -d a.out a.out: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <.text>: 0: 2e 48 8b 04 25 44 33 mov %cs:0x11223344,%rax 7: 22 11 9: 2e 48 8b 04 25 44 33 mov %cs:0x11223344,%rax 10: 22 11 12: 2e 48 8b 04 25 44 33 mov %cs:0x11223344,%rax 19: 22 11 1b: 2e 48 8b 04 25 44 33 mov %cs:0x11223344,%rax 22: 22 11 # as --version GNU assembler (GNU Binutils for Debian) 2.30 Copyright (C) 2018 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `x86_64-linux-gnu'. There does not appear to be a way to get as to correctly assemble these instructions without including ".intel_synax noprefix" in the source file. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils