mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 22:07:56 +02:00
* don't change the fpu control word in the initialisation code of dynamic
libraries (mantis #16263, #16801) git-svn-id: trunk@16347 -
This commit is contained in:
parent
c53b2a871b
commit
c14574bb56
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10665,6 +10665,7 @@ tests/webtbs/tw16188.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1622.pp svneol=native#text/plain
|
||||
tests/webtbs/tw16222.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw1623.pp svneol=native#text/plain
|
||||
tests/webtbs/tw16263a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw16311.pp svneol=native#text/plain
|
||||
tests/webtbs/tw16315a.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw16315b.pp svneol=native#text/pascal
|
||||
|
@ -69,7 +69,9 @@ end;
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
SysInitFPU;
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if not IsLibrary then
|
||||
SysInitFPU;
|
||||
end;
|
||||
|
||||
{$ifdef wince}
|
||||
|
@ -110,6 +110,9 @@ procedure fpc_cpuinit;
|
||||
setup_fastmove;
|
||||
}
|
||||
os_supports_sse:=false;
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if IsLibrary then
|
||||
Default8087CW:=Get8087CW;
|
||||
end;
|
||||
|
||||
|
||||
@ -1522,6 +1525,11 @@ procedure fpc_cpucodeinit;
|
||||
sse_check:=false;
|
||||
end;
|
||||
has_sse_support:=os_supports_sse;
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if has_sse_support and
|
||||
IsLibrary then
|
||||
mxcsr:=GetSSECSR;
|
||||
|
||||
has_mmx_support:=mmx_support;
|
||||
SysResetFPU;
|
||||
if not(IsLibrary) then
|
||||
|
@ -43,11 +43,15 @@ procedure fpc_cpuinit;
|
||||
var
|
||||
tmp32: longint;
|
||||
begin
|
||||
{ enable div by 0 and invalid operation fpu exceptions }
|
||||
{ round towards zero; ieee compliant arithmetics }
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if not IsLibrary then
|
||||
begin
|
||||
{ enable div by 0 and invalid operation fpu exceptions }
|
||||
{ round towards zero; ieee compliant arithmetics }
|
||||
|
||||
tmp32 := get_fsr();
|
||||
set_fsr((tmp32 and $fffffffc) or $00000001);
|
||||
tmp32 := get_fsr();
|
||||
set_fsr((tmp32 and $fffffffc) or $00000001);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -56,7 +56,9 @@ end;
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
fpc_enable_ppc_fpu_exceptions;
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if not IsLibrary then
|
||||
fpc_enable_ppc_fpu_exceptions;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -43,7 +43,9 @@ end;
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
fpc_enable_ppc_fpu_exceptions;
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if not IsLibrary then
|
||||
fpc_enable_ppc_fpu_exceptions;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
|
@ -24,13 +24,6 @@
|
||||
Primitives
|
||||
****************************************************************************}
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
SysResetFPU;
|
||||
if not(IsLibrary) then
|
||||
SysInitFPU;
|
||||
end;
|
||||
|
||||
{$define FPC_SYSTEM_HAS_SPTR}
|
||||
Function Sptr : Pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
asm
|
||||
@ -593,6 +586,19 @@ const
|
||||
|
||||
mxcsr : dword = MM_MaskUnderflow or MM_MaskPrecision or MM_MaskDenorm;
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
{ don't let libraries influence the FPU cw set by the host program }
|
||||
if IsLibrary then
|
||||
begin
|
||||
Default8087CW:=Get8087CW;
|
||||
mxcsr:=GetSSECSR;
|
||||
end;
|
||||
SysResetFPU;
|
||||
if not(IsLibrary) then
|
||||
SysInitFPU;
|
||||
end;
|
||||
|
||||
{$define FPC_SYSTEM_HAS_SYSINITFPU}
|
||||
Procedure SysInitFPU;
|
||||
var
|
||||
|
26
tests/webtbs/tw16263a.pp
Normal file
26
tests/webtbs/tw16263a.pp
Normal file
@ -0,0 +1,26 @@
|
||||
{ %norun }
|
||||
{ %target=darwin,linux,freebsd,solaris,beos,haiku }
|
||||
|
||||
{$mode delphi}
|
||||
|
||||
{$ifdef darwin}
|
||||
{$PIC+}
|
||||
{$endif darwin}
|
||||
|
||||
{$ifdef CPUX86_64}
|
||||
{$ifndef WINDOWS}
|
||||
{$PIC+}
|
||||
{$endif WINDOWS}
|
||||
{$endif CPUX86_64}
|
||||
|
||||
library tw16263a;
|
||||
|
||||
function divide(d1,d2: double): double; cdecl;
|
||||
begin
|
||||
divide:=d1/d2;
|
||||
end;
|
||||
|
||||
begin
|
||||
// check that the library does not re-enable fpu exceptions
|
||||
divide(1.0,0.0);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user