Bug 2505 – Inline Assembly: Getting offset of a label
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-12-10T13:30:00Z
Last change time
2014-03-01T00:36:27Z
Keywords
spec
Assigned to
nobody
Creator
p0lycyb0rg
Comments
Comment #0 by p0lycyb0rg — 2008-12-10T13:30:51Z
Dear bugfixers of D,
D's offsetof does not seem to work in inline assembly. I'm afraid, this hinders the use of D as a system programming language and I'd really appreciate this implementation in version 1, too. Let's move on an example:
--
import std.stdio;
void main()
{
asm
{
call L1;
L1: pop EBP;
sub EBP, offsetof L1;
}
}
--
Line 9: undefined identifier 'L1'
I have read your other bug reports about offsetof and on the first 2 asm lines I'm using your 'workaround' way. But the 3rd line of asm code is very important to implement PIC (Position Independent Code). I'm sure you understand it's importance and looking forward to get the bug fixed as soon as possible.
Thank you very much. Regards, Robert Forrest
Comment #1 by bugzilla — 2012-01-22T21:10:01Z
It's a longstanding problem with the inline assembler.
Comment #2 by yebblies — 2012-12-26T23:27:53Z
*** This issue has been marked as a duplicate of issue 1829 ***