Support NASM's upcoming RIP-relative syntax, with a few differences.

This adds a "default" directive that takes either "rel" or "abs".  This
sets whether the default mode for simple displacements is RIP-relative (rel)
or not (abs).  The default without a directive is "abs".

Also added is corresponding "rel" and "abs" effective address modifiers
to override whatever default is set:
[rel label] is RIP-relative
[abs label] is not.

In default rel mode, [label] defaults to the former, in default abs mode,
the latter.  Also, segment overrides (note difference from NASM below) are
abs regardless of mode, unless explicitly overridden with rel:
[fs:label] is always abs
[rel fs:label] is always rel

However, we have a number of differences from NASM in this handling due to
what I feel to be yasm's more sane handling of [dword ...] and [qword ...].
In yasm, these set the displacement size, rather than the address size; the
latter is set using a a32/a64 prefix.  I feel this is more sane as in 64-bit
mode the two can be different in the MovOffs (A0/A1 mov *ax) case.

Also, yasm disables default-rel mode if any segment register is used, not
just FS or GS as NASM currently does.

See modules/arch/x86/tests/riprel1.asm and
modules/arch/x86/tests/riprel2.asm for examples, as well as my recent
posting to the nasm-devel mailing list on SF.

svn path=/trunk/yasm/; revision=1963
17 files changed