[Issue 14872] [2.068.2] Label address in asm [x86-64]

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 21 00:16:14 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=14872

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 OS|Windows                     |All

--- Comment #2 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Daniel from comment #0)
> 32bit x86 asm works fine, but I can't get 64bit working.

I think that has something to do with Intel x64 being position-independent,
meaning that "lea RAX, lbl1" is not going to do what you want. It looks like in
case of DMD, it's generating nonsense code (mov eax, eax), but it could still
use the offset relative to some base. In any case, it certainly won't be the
actual in-address memory of the code at that label (so that you can "jmp" to
it).

So, your example is a bit nonsensical, but DMD should still not be emitting
garbage code, and either generate an error or use some other kind of offset (so
that it's at least possible to use the offset in calculations to produce
something useful).

--


More information about the Digitalmars-d-bugs mailing list