https://sourceware.org/bugzilla/show_bug.cgi?id=32462
Bug ID: 32462 Summary: objdump incorrectly disassembles PAUSE with REX.B prefix Product: binutils Version: 2.42 Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: michaeljclark at mac dot com Target Milestone: --- aka 'rep xchg r8d, eax' disassembles as 'rex.B pause' # observations - NOP 'nof3 norexb 90' is 'xchg eax, eax' under the hood. - PAUSE is 'rep nop' under the hood. - adding REX.B to NOP produces 'xchg r8d, eax' which is presumably why it is defined as 'nof3 norexb 90'. there appears to be am issue when you add REX.B to PAUSE. it is no longer PAUSE. logically it is 'rep xchg r8d, eax': $ ./build/llvm_dump -x f3 90 f3 90 pause $ ./scripts/binutils_dump.sh f3 90 f3 90 pause $ ./build/llvm_dump -x f3 41 90 f3 41 90 xchg eax, r8d $ ./scripts/binutils_dump.sh f3 41 90 f3 41 90 rex.B pause LLVM disassembles this almost correctly but it is missing the rep prefix. objdump displays it as 'rex.B pause' which seems bad as it presumably has architectural state changes. I will test this out in QEMU and on real hardware but it makes sense in light of PAUSE being an alias for 'rep nop'. NOP has 'rorexb nof3 90' in its NASM metadata. so perhaps this clash with REX.B may have been overlooked for PAUSE because underneath it is an alias for 'rep xchg eax, eax'. by the way, gas won't assemble 'rep xchg r8d, eax' likely, because XCHG is not a string instruction. but the clang assembler allows me to assemble it: $ as --version | head -1 GNU assembler (GNU Binutils for Ubuntu) 2.42 $ clang --version | head -1 Ubuntu clang version 18.1.3 (1ubuntu1) $ cat c.s .intel_syntax noprefix rep xchg r8d, eax $ as -o c.o c.s c.s: Assembler messages: c.s:2: Error: invalid instruction `xchg' after `rep' $ clang -c c.s $ objdump -d c.o ... 0000000000000000 <.text>: 0: f3 41 90 rex.B pause -- You are receiving this mail because: You are on the CC list for the bug.