[Issue 9760] New: PIC code uses variable and thus needs a stack frame
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 19 13:48:00 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9760
Summary: PIC code uses variable and thus needs a stack frame
Product: D
Version: D2
Platform: x86
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: code at dawg.eu
--- Comment #0 from Martin Nowak <code at dawg.eu> 2013-03-19 13:47:58 PDT ---
cat > bug.d << CODE
void foo() {}
void bug()
{
asm { naked; }
foo();
asm { ret; }
}
CODE
--------------------
dmd -c -m32 -fPIC bug.d
--------------------
_D3bug3bugFZv PROC NEAR
call ?_003 ; 0000 _ E8, 00000000
?_003 LABEL NEAR
pop eax ; 0005 _ 58
add eax, offset _GLOBAL_OFFSET_TABLE_-$+1H ; 0006 _ 05,
00000002(GOT r)
mov dword ptr [ebp-4H], eax ; 000B _ 89. 45, FC
mov ebx, dword ptr [ebp-4H] ; 000E _ 8B. 5D, FC
call _D3bug3fooFZv ; 0011 _ E8,
FFFFFFFC(PLT r)
ret ; 0016 _ C3
_D3bug3bugFZv ENDP
EBP isn't set up so storing the localgot will overwrite some other memory.
Not sure if we want to fix this because one might argue that non-asm is invalid
in naked asm blocks.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list