WRT question

Peter Johnson peter at tortall.net
Fri Mar 9 09:28:51 PST 2007


On Fri, 9 Mar 2007, Chris tophe wrote:
> I was wondering, is there a reason for :
> lea rsi,[symbol wrt rip]
> to work, and not :
> mov rsi,symbol wrt rip  (expression too complex)
> documentation seems to suggest it should work, in "2.6 SEG and WRT" section :
> mov bx, symbol wrt weird_seg

RIP-relative is special, as unlike wrt weird_seg, it's not just a 
relocation but is rather a flag to the processor to treat a load offset as 
RIP-relative instead of absolute (kind of like [symbol+rax] is a flag to 
the processor to add RAX to the symbol).  This flag (like that for 
[symbol+rax]) is set via the ModRM byte and thus is only available in 
effective addresses (memory operands) and not in immediate operands.

Peter


More information about the yasm-devel mailing list