diff --git a/compiler/globals.pas b/compiler/globals.pas index bd93560fbc..3a116493fd 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -327,7 +327,7 @@ interface { parameter switches } debugstop : boolean; {$EndIf EXTDEBUG} - { Application type (platform specific) + { Application type (platform specific) see globtype.pas for description } apptype : tapptype; @@ -915,7 +915,7 @@ implementation {$undef GETENVOK} {$else} GetEnvPchar:=StrPNew(GetEnvironmentVariable(envname)); - if (length(GetEnvPChar)=0) then + if (length(GetEnvPChar)=0) then begin FreeEnvPChar(GetEnvPChar); GetEnvPChar:=nil; @@ -1106,7 +1106,9 @@ implementation (abiinfo[t].name=hs) then begin a:=t; - result:=true; + { abi_old_win32_gnu is a win32 i386 specific "feature" } + if (t<>abi_old_win32_gnu) or (target_info.system=system_i386_win32) then + result:=true; break; end; end; diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index 5f230e82b9..bfac82d7eb 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -380,7 +380,8 @@ unit cgcpu; { but not on win32 } { and not for safecall with hidden exceptions, because the result } { wich contains the exception is passed in EAX } - if (target_info.system <> system_i386_win32) and + if ((target_info.system <> system_i386_win32) or + (target_info.abi=abi_old_win32_gnu)) and not ((current_procinfo.procdef.proccalloption = pocall_safecall) and (tf_safecall_exceptions in target_info.flags)) and paramanager.ret_in_param(current_procinfo.procdef.returndef, diff --git a/compiler/i386/n386cal.pas b/compiler/i386/n386cal.pas index 647872b6c0..d032174611 100644 --- a/compiler/i386/n386cal.pas +++ b/compiler/i386/n386cal.pas @@ -93,7 +93,8 @@ implementation it is always the first parameter (apart from hidden parentfp, but this one is never put into a register (vs_nonregable set) so funcret is always in EAX for register calling } - if (target_info.system = system_i386_win32) and + if ((target_info.system = system_i386_win32) and + not (target_info.abi=abi_old_win32_gnu)) and paramanager.ret_in_param(procdefinition.returndef,procdefinition) and not ((procdefinition.proccalloption=pocall_register) or ((procdefinition.proccalloption=pocall_internproc) and diff --git a/compiler/systems.inc b/compiler/systems.inc index 97c7bbbb63..b66f748161 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -263,6 +263,7 @@ tabi = (abi_default ,abi_powerpc_sysv,abi_powerpc_aix ,abi_eabi,abi_armeb,abi_eabihf + ,abi_old_win32_gnu ); diff --git a/compiler/systems.pas b/compiler/systems.pas index cd1e2c21d7..f3287d3951 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -204,7 +204,7 @@ interface end; tabiinfo = record - name: string[10]; + name: string[11]; supported: boolean; end; @@ -344,7 +344,8 @@ interface (name: 'AIX' ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}), (name: 'EABI' ; supported:{$ifdef FPC_ARMEL}true{$else}false{$endif}), (name: 'ARMEB' ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}), - (name: 'EABIHF' ; supported:{$ifdef FPC_ARMHF}true{$else}false{$endif}) + (name: 'EABIHF' ; supported:{$ifdef FPC_ARMHF}true{$else}false{$endif}), + (name: 'OLDWIN32GNU'; supported:{$ifdef CPUI386}true{$else}false{$endif}) ); var