浏览代码

Add -Caoldwin32gnu ABI option to cope with 'ret $4' issues in old GNU mingw32 C compiler (version below 4.7)

git-svn-id: trunk@26536 -
pierre 11 年之前
父节点
当前提交
1cec09f979
共有 5 个文件被更改,包括 13 次插入7 次删除
  1. 5 3
      compiler/globals.pas
  2. 2 1
      compiler/i386/cgcpu.pas
  3. 2 1
      compiler/i386/n386cal.pas
  4. 1 0
      compiler/systems.inc
  5. 3 2
      compiler/systems.pas

+ 5 - 3
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;

+ 2 - 1
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,

+ 2 - 1
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

+ 1 - 0
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
        );
 
 

+ 3 - 2
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