fpc/tests/tbs/tb0193.pp
Jonas Maebe 61522d00a2 * fixed tests now that i386 assembler code is checked for correct PIC
usage in case PIC generation is on (some by adding PIC-versions of
    the assembler code, most by adding -Cg- to the options to be used).

    Note: the Intel assembler reader does not yet support the Delphi
    PIC construct, so tests with that (like test/tasmread and test/tcg1)
    do not work with -Cg on non-Darwin (Darwin needs a different PIC
    construct)

git-svn-id: trunk@9370 -
2007-12-01 14:34:50 +00:00

52 lines
1018 B
ObjectPascal

{ %skiptarget=win32,win64 }
{ %OPT=-Cg- }
{ Old file: tbs0227.pp }
{ external var does strange things when declared in localsymtable OK 0.99.11 (PFV) }
var
stacksize : ptrint;external name '__stklen';
function getstacksize:ptrint;assembler;
asm
{$ifdef CPUI386}
movl stacksize,%eax
end ['EAX'];
{$endif CPUI386}
{$ifdef CPUX86_64}
movq stacksize@GOTPCREL(%rip),%rax
movq (%rax),%rax
end ['EAX'];
{$endif CPUX86_64}
{$ifdef CPU68K}
move.l stacksize,d0
end ['D0'];
{$endif CPU68K}
{$ifdef cpupowerpc}
{$ifndef macos}
lis r3, stacksize@ha
lwz r3, stacksize@l(r3)
{$else macos}
lwz r3, stacksize(r2)
lwz r3, 0(r3)
{$endif macos}
end;
{$endif cpupowerpc}
{$ifdef cpusparc}
sethi %hi(stacksize),%i0
or %i0,%lo(stacksize),%i0
end;
{$endif cpusparc}
{$ifdef cpuarm}
ldr r0,.Lpstacksize
ldr r0,[r0]
b .Lend
.Lpstacksize:
.long stacksize
.Lend:
end;
{$endif cpuarm}
begin
writeln(getstacksize);
end.