On 02.10.2024 17:38, Andrew Cooper wrote: > On 02/10/2024 4:27 pm, Andrew Cooper wrote: >> Despite claiming full APX support in the 2.43 release, binutils trunk doesn't >> tolerate JMPABS at all. Clang-IAS like it but only when encoded as an >> immediate, despite the fact the operand should be a moffset and encoded >> without a $ prefix. https://godbolt.org/z/P4Ph3svha > > Actually, no. Despite overlaying MOV moffs/rax, to share decode with > another instruction that has a forced 8-byte immedate operation, it's > used as a proper immediate, not a memory address. > > So on further consideration, the $ prefix is correct.
This one's actually pretty ambiguous. Other direct branches don't use $, i.e. consider the operand a "displacement", not an "immediate". Except for far direct branches, which have (two) immediate operands. Originally coming from the Intel syntax world, where this distinction doesn't even exist, I question that arrangement. Imo far direct branches should have a non-immediate and an immediate operand (the latter being the segment / selector). That would also properly distinguish which one's which. Yet that ship has sailed; we could add support for the alternative forms, but we can't drop support for the 2- immediate variants. I'd prefer to not repeat the mistake for JMPABS: The destination generally is a symbol, and hence more natural to use without $. In the end it may be prudent to simply permit both forms. In any event I've added to my gas TODO list the need for JMPABS support. Jan