The only machine encodings for direct near jmp
s use relative displacements, not absolute. See also the x86 tag wiki for more links to docs / manuals, including the official MASM manual. I don't think there's any point wading through it for this issue, though.
There is no near-jmp
that takes an immediate absolute displacement, so there's no risk of an assembler ever using a non-PIC branch unexpectedly.
An absolute near jump would require the address in a register or memory operand, so MASM can't just assemble jmp target
into
section .rodata
pointer_to_target dq target ; or dd for a 32bit pointer
section .text
jmp [pointer_to_target]
because that would be ridiculous. IDK if you'd ever find documentation stating that this specific piece of insanity is specifically impossible.
The only way I could imagine an assembler doing anything like this for you is if there was some kind of "Huge code model" where all jump targets were referenced with 64 bit pointers instead of 32 bit relative displacements.
But AFAIK, if you want to do that, you have to do it yourself in all existing assemblers.
Documentation gets bloated enough without mentioning every weird thing that a program doesn't do, so I wouldn't expect to find anything specific about this. This is probably one of those things that's assumed to be obvious and goes without saying. (Or that the syntax matches what Intel uses in their instruction reference manual.)
As Jester says, you won't get a far
jump without asking for it, so there's no risk of any assembler using the JMP ptr16:32
encoding (EA imm16(segment) imm32(offset)
) for a normal jmp.