Bug 30426 - gas x86: reject {call,jmp} [offset func] in Intel syntax
Summary: gas x86: reject {call,jmp} [offset func] in Intel syntax
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-06 20:34 UTC by Fangrui Song
Modified: 2023-05-08 16:07 UTC (History)
1 user (show)

See Also:
Host:
Target: i686* x86_64*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2023-05-06 20:34:25 UTC
% cat a.s
call [offset func]
jmp [offset func]
% as -msyntax=intel a.s -o a.o
% objdump -M intel -dr a.o

a.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <.text>:
   0:   e8 00 00 00 00          call   0x5
                        1: R_X86_64_PLT32       func-0x4
   5:   e9 00 00 00 00          jmp    0xa
                        6: R_X86_64_PLT32       func-0x4


MSVC ml64.exe reports "error A2023:instruction operand must have size"
for the following assembly listing

  extrn k:proc
  _text segment
  call [offset k]
  ; call qword ptr [offset k]  ; this is somehow accepted
  _text ends
  end


This is a patch for LLVM integrated assembler (used by `clang -c -masm=intel`, llvm-mc, etc) to reject call [offset k] and jmp [offset k]: https://reviews.llvm.org/D150048