Browse Source

* from Yury Sidorov:
+ Added new target WinCE for i386 (to be able compile and run programs in WinCE emulator)

git-svn-id: trunk@596 -

florian 20 years ago
parent
commit
83c6b3aca2

+ 13 - 0
compiler/ogcoff.pas

@@ -1780,9 +1780,22 @@ const go32v2stub : array[0..2047] of byte=(
             comment : '';
           );
 
+       as_i386_pecoffwince_info : tasminfo =
+          (
+            id     : as_i386_pecoffwince;
+            idtxt  : 'PECOFFWINCE';
+            asmbin : '';
+            asmcmd : '';
+            supported_target : system_i386_wince;
+            flags : [af_outputbinary];
+            labelprefix : '.L';
+            comment : '';
+          );
+
 
 initialization
   RegisterAssembler(as_i386_coff_info,TCoffAssembler);
   RegisterAssembler(as_i386_pecoff_info,TPECoffAssembler);
   RegisterAssembler(as_i386_pecoffwdosx_info,TPECoffAssembler);
+  RegisterAssembler(as_i386_pecoffwince_info,TPECoffAssembler);
 end.

+ 1 - 1
compiler/pdecsub.pas

@@ -1920,7 +1920,7 @@ const
               if not(
                      assigned(pd.import_dll) and
                      (target_info.system in [system_i386_win32,system_i386_wdosx,
-                                             system_i386_emx,system_i386_os2,system_arm_wince])
+                                             system_i386_emx,system_i386_os2,system_arm_wince,system_i386_wince])
                     ) then
                 begin
                   if not(pd.proccalloption in [pocall_cdecl,pocall_cppdecl]) then

+ 1 - 1
compiler/pdecvar.pas

@@ -871,7 +871,7 @@ implementation
                 { address }
                 else if is_constintnode(pt) and
                         ((target_info.system in [system_i386_go32v2,system_i386_watcom,
-                                                 system_i386_wdosx,system_i386_win32,system_arm_wince]) or
+                                                 system_i386_wdosx,system_i386_win32,system_arm_wince,system_i386_wince]) or
                          (m_objfpc in aktmodeswitches) or
                          (m_delphi in aktmodeswitches)) then
                  begin

+ 2 - 2
compiler/pexports.pas

@@ -113,7 +113,7 @@ implementation
                      an underline }
                    if InternalProcName[1]='_' then
                      delete(InternalProcName,1,1)
-                   else if (target_info.system in [system_i386_win32,system_i386_wdosx,system_arm_wince]) and UseDeffileForExports then
+                   else if (target_info.system in [system_i386_win32,system_i386_wdosx,system_arm_wince,system_i386_wince]) and UseDeffileForExports then
                      begin
                        Message(parser_e_dlltool_unit_var_problem);
                        Message(parser_e_dlltool_unit_var_problem2);
@@ -134,7 +134,7 @@ implementation
                     end;
                    hp.options:=hp.options or eo_index;
                    pt.free;
-                   if target_info.system in [system_i386_win32,system_i386_wdosx,system_arm_wince] then
+                   if target_info.system in [system_i386_win32,system_i386_wdosx,system_arm_wince,system_i386_wince] then
                     DefString:=srsym.realname+'='+InternalProcName+' @ '+tostr(hp.index)
                    else
                     DefString:=srsym.realname+'='+InternalProcName; {Index ignored!}

+ 1 - 1
compiler/pmodules.pas

@@ -107,7 +107,7 @@ implementation
          begin
            { regenerate the importssection for win32 }
            if assigned(importssection) and
-              (target_info.system in [system_i386_win32,system_i386_wdosx, system_arm_wince]) then
+              (target_info.system in [system_i386_win32,system_i386_wdosx, system_arm_wince,system_i386_wince]) then
             begin
               importsSection.clear;
               importlib.generatesmartlib;

+ 1 - 1
compiler/psub.pas

@@ -1296,7 +1296,7 @@ implementation
                     not(
                         assigned(pd.import_dll) and
                         (target_info.system in [system_i386_win32,system_i386_wdosx,
-                                                system_i386_emx,system_i386_os2,system_arm_wince])
+                                                system_i386_emx,system_i386_os2,system_arm_wince,system_i386_wince])
                        ) then
                    begin
                      s:=proc_get_importname(pd);

+ 3 - 1
compiler/systems.pas

@@ -115,7 +115,8 @@ interface
 	     system_powerpc_Amiga,      { 36 }
              system_x86_64_win64,       { 37 }
              system_arm_wince,          { 38 }
-             system_ia64_win64          { 39 }
+             system_ia64_win64,         { 39 }
+             system_i386_wince          { 40 }
        );
 
        tasm = (as_none
@@ -139,6 +140,7 @@ interface
              ,as_darwin
              ,as_x86_64_masm
              ,as_x86_64_pecoff
+             ,as_i386_pecoffwince
        );
 
        tar = (ar_none

+ 65 - 0
compiler/systems/i_win.pas

@@ -218,6 +218,68 @@ unit i_win;
             use_function_relative_addresses : true
           );
           
+       system_i386_wince_info : tsysteminfo =
+          (
+            system       : system_i386_wince;
+            name         : 'WinCE for i386';
+            shortname    : 'WinCE';
+            flags        : [];
+            cpu          : cpu_i386;
+            unit_env     : '';
+            extradefines : 'UNDER_CE';
+            exeext       : '.exe';
+            defext       : '.def';
+            scriptext    : '.bat';
+            smartext     : '.sl';
+            unitext      : '.ppu';
+            unitlibext   : '.ppl';
+            asmext       : '.s';
+            objext       : '.o';
+            resext       : '.rc';
+            resobjext    : '.or';
+            sharedlibext : '.dll';
+            staticlibext : '.a';
+            staticlibprefix : 'libp';
+            sharedlibprefix : '';
+            sharedClibext : '.dll';
+            staticClibext : '.a';
+            staticClibprefix : 'lib';
+            sharedClibprefix : '';
+            p_ext_support : false;
+            Cprefix      : '_';
+            newline      : #13#10;
+            dirsep       : '\';
+            files_case_relevent : true;
+            assem        : as_i386_pecoffwince;
+            assemextern  : as_gas;
+            link         : nil;
+            linkextern   : nil;
+            ar           : ar_gnu_ar;
+            res          : res_gnu_windres;
+            script       : script_dos;
+            endian       : endian_little;
+            alignment    :
+              (
+                procalign       : 4;
+                loopalign       : 4;
+                jumpalign       : 0;
+                constalignmin   : 0;
+                constalignmax   : 4;
+                varalignmin     : 0;
+                varalignmax     : 4;
+                localalignmin   : 4;
+                localalignmax   : 4;
+                recordalignmin  : 0;
+                recordalignmax  : 4;
+                maxCrecordalign : 16
+              );
+            first_parm_offset : 8;
+            stacksize    : 262144;
+            DllScanSupported:true;
+            use_function_relative_addresses : true
+          );
+
+          
   implementation
 
 initialization
@@ -227,6 +289,9 @@ initialization
       set_source_info(system_i386_win32_info);
     {$endif WDOSX}
   {$endif WIN32}
+  {$ifdef WINCE}
+    set_source_info(system_i386_wince_info);
+  {$endif WINCE}
 {$endif CPU86}
 
 {$ifdef CPUX86_64}

+ 21 - 12
compiler/systems/t_win.pas

@@ -1037,8 +1037,11 @@ begin
   AsBinStr:=FindUtil(utilsprefix+'as');
   if RelocSection then
    RelocStr:='--base-file base.$$$';
-  if apptype=app_gui then
-   AppTypeStr:='--subsystem windows';
+  if target_info.system in [system_arm_wince,system_i386_wince] then
+   AppTypeStr:='--subsystem wince'
+  else
+    if apptype=app_gui then
+     AppTypeStr:='--subsystem windows';
   if assigned(DLLImageBase) then
    ImageBaseStr:='--image-base=0x'+DLLImageBase^;
   if (cs_link_strip in aktglobalswitches) then
@@ -1273,10 +1276,6 @@ var
   secroot,hsecroot : psecfill;
   zerobuf : pointer;
 begin
-  {$ifdef ARM}
-    postprocessexecutable:=true;
-    exit;
-  {$endif ARM}
   postprocessexecutable:=false;
   { when -s is used or it's a dll then quit }
   if (cs_link_extern in aktglobalswitches) then
@@ -1317,12 +1316,16 @@ begin
   { sub system }
   { gui=2 }
   { cui=3 }
-  case apptype of
-    app_gui :
-      peheader.Subsystem:=2;
-    app_cui :
-      peheader.Subsystem:=3;
-  end;
+  { wincegui=9 }
+  if target_info.system in [system_arm_wince,system_i386_wince] then
+    peheader.Subsystem:=9
+  else
+    case apptype of
+      app_gui :
+        peheader.Subsystem:=2;
+      app_cui :
+        peheader.Subsystem:=3;
+    end;
   if dllversion<>'' then
     begin
      peheader.MajorImageVersion:=dllmajor;
@@ -1655,6 +1658,12 @@ initialization
   RegisterDLLScanner(system_i386_win32,TDLLScannerWin32);
   RegisterRes(res_gnu_windres_info);
   RegisterTarget(system_i386_win32_info);
+  
+  RegisterExternalLinker(system_i386_wince_info,TLinkerWin32);
+  RegisterImport(system_i386_wince,TImportLibWin32);
+  RegisterExport(system_i386_wince,TExportLibWin32);
+  RegisterDLLScanner(system_i386_wince,TDLLScannerWin32);
+  RegisterTarget(system_i386_wince_info);
 {$endif i386}
 {$ifdef x86_64}
   RegisterExternalLinker(system_x64_win64_info,TLinkerWin32);