From 0ee2ac7451b30242e6a373868d5a6def7313751d Mon Sep 17 00:00:00 2001 From: carl Date: Thu, 4 Apr 2002 18:30:22 +0000 Subject: [PATCH] + added wdosx support (patch from Pavel) --- compiler/comprsrc.pas | 7 +++++-- compiler/finput.pas | 7 +++++-- compiler/gendef.pas | 7 +++++-- compiler/i386/cga.pas | 34 +++++++++++++++++++++++++--------- compiler/i386/cputarg.pas | 8 +++++++- compiler/ogcoff.pas | 26 +++++++++++++++++++++++++- compiler/options.pas | 7 +++++-- compiler/pexports.pas | 9 ++++++--- compiler/pmodules.pas | 19 +++++++++++-------- compiler/psub.pas | 13 +++++++------ 10 files changed, 101 insertions(+), 36 deletions(-) diff --git a/compiler/comprsrc.pas b/compiler/comprsrc.pas index 1c4e747d5f..81e834eeae 100644 --- a/compiler/comprsrc.pas +++ b/compiler/comprsrc.pas @@ -128,7 +128,7 @@ begin While not current_module.ResourceFiles.Empty do begin case target_info.target of - target_i386_win32: + target_i386_win32,target_i386_wdosx: hr:=new(presourcefile,init(current_module.ResourceFiles.getfirst)); else Message(scan_e_resourcefiles_not_supported); @@ -142,7 +142,10 @@ end; end. { $Log$ - Revision 1.10 2001-08-07 18:47:12 peter + Revision 1.11 2002-04-04 18:32:37 carl + + added wdosx support (patch from Pavel) + + Revision 1.10 2001/08/07 18:47:12 peter * merged netbsd start * profile for win32 diff --git a/compiler/finput.pas b/compiler/finput.pas index fce3499f7d..cdcdb55e54 100644 --- a/compiler/finput.pas +++ b/compiler/finput.pas @@ -629,7 +629,7 @@ uses if AllowOutput and (OutputFile<>'') and (compile_level=1) then n:=OutputFile; staticlibfilename:=stringdup(p+target_info.staticlibprefix+n+target_info.staticlibext); - if target_info.target=target_i386_WIN32 then + if target_info.target in [target_i386_WIN32,target_i386_wdosx] then sharedlibfilename:=stringdup(p+n+target_info.sharedlibext) else sharedlibfilename:=stringdup(p+target_info.sharedlibprefix+n+target_info.sharedlibext); @@ -687,7 +687,10 @@ uses end. { $Log$ - Revision 1.11 2001-08-04 10:23:54 peter + Revision 1.12 2002-04-04 18:34:00 carl + + added wdosx support (patch from Pavel) + + Revision 1.11 2001/08/04 10:23:54 peter * updates so it works with the ide Revision 1.10 2001/06/03 15:15:31 peter diff --git a/compiler/gendef.pas b/compiler/gendef.pas index 8fac1c7a3f..ff11b614e9 100644 --- a/compiler/gendef.pas +++ b/compiler/gendef.pas @@ -125,7 +125,7 @@ begin writeln(t,'STACKSIZE'#9+tostr(stacksize)); writeln(t,'HEAPSIZE'#9+tostr(heapsize)); end; - target_i386_win32 : + target_i386_win32, target_i386_wdosx : begin if description<>'' then writeln(t,'DESCRIPTION '+''''+description+''''); @@ -160,7 +160,10 @@ end; end. { $Log$ - Revision 1.6 2001-04-13 01:22:07 peter + Revision 1.7 2002-04-04 18:36:46 carl + + added wdosx support (patch from Pavel) + + Revision 1.6 2001/04/13 01:22:07 peter * symtable change to classes * range check generation and errors fixed, make cycle DEBUG=1 works * memory leaks fixed diff --git a/compiler/i386/cga.pas b/compiler/i386/cga.pas index d7fae599fb..705934f2be 100644 --- a/compiler/i386/cga.pas +++ b/compiler/i386/cga.pas @@ -156,10 +156,19 @@ implementation {$endif} ; -{$ifndef NOTARGETWIN32} +{$ifdef NOTARGETWIN32} + {$define __NOWINPECOFF__} +{$endif} + +{$ifdef NOTARGETWDOSX} + {$define __NOWINPECOFF__} +{$endif} + +{$ifndef __NOWINPECOFF__} const winstackpagesize = 4096; -{$endif} +{$endif} + {***************************************************************************** Helpers @@ -1185,6 +1194,7 @@ implementation case target_info.target of target_i386_win32, target_i386_freebsd, + target_i386_wdosx, target_i386_linux: begin getaddrlabel(pl); @@ -1490,9 +1500,9 @@ implementation r : treference; power,len : longint; opsize : topsize; -{$ifndef NOTARGETWIN32} +{$ifndef __NOWINPECOFF__} again,ok : tasmlabel; -{$endif} +{$endif} begin if (tsym(p).typ=varsym) and (tvarsym(p).varspez=vs_value) and @@ -1749,7 +1759,7 @@ implementation emitinsertcall('FPC_INITIALIZELOCALTHREADVARS'); { initialize profiling for win32 } - if (target_info.target=target_I386_WIN32) and + if (target_info.target in [target_I386_WIN32,target_I386_wdosx]) and (cs_profile in aktmoduleswitches) then emitinsertcall('__monstartup'); end; @@ -1835,7 +1845,7 @@ implementation nostackframe:=false; if stackframe<>0 then begin -{$ifndef NOTARGETWIN32} +{$ifndef __NOWINPECOFF__} { windows guards only a few pages for stack growing, } { so we have to access every page first } if (target_info.target=target_i386_win32) and @@ -1866,11 +1876,11 @@ implementation end end else -{$endif NOTARGETWIN32} +{$endif __NOWINPECOFF__} exprasmList.insert(Taicpu.Op_const_reg(A_SUB,S_L,stackframe,R_ESP)); if (cs_check_stack in aktlocalswitches) and not(target_info.target in [target_i386_freebsd,target_i386_netbsd, - target_i386_linux,target_i386_win32]) then + target_i386_linux,target_i386_win32,target_i386_wdosx]) then begin emitinsertcall('FPC_STACKCHECK'); exprasmList.insert(Taicpu.Op_const(A_PUSH,S_L,stackframe)); @@ -2609,11 +2619,17 @@ implementation end; {$endif test_dest_loc} +{$ifdef __NOWINPECOFF__} + {$undef __NOWINPECOFF__} +{$endif} end. { $Log$ - Revision 1.19 2002-04-02 17:11:33 peter + Revision 1.20 2002-04-04 18:30:22 carl + + added wdosx support (patch from Pavel) + + Revision 1.19 2002/04/02 17:11:33 peter * tlocation,treference update * LOC_CONSTANT added for better constant handling * secondadd splitted in multiple routines diff --git a/compiler/i386/cputarg.pas b/compiler/i386/cputarg.pas index 4388affdc5..43c1dc3eac 100644 --- a/compiler/i386/cputarg.pas +++ b/compiler/i386/cputarg.pas @@ -60,6 +60,9 @@ implementation {$ifndef NOTARGETBEOS} ,t_beos {$endif} + {$ifndef NOTARGETWDOSX} + ,t_wdosx + {$endif} {************************************** Assemblers @@ -82,7 +85,10 @@ implementation end. { $Log$ - Revision 1.3 2002-03-28 20:48:04 carl + Revision 1.4 2002-04-04 18:31:37 carl + + added wdosx support (patch from Pavel) + + Revision 1.3 2002/03/28 20:48:04 carl - remove go32v1 support Revision 1.2 2001/06/03 15:12:47 peter diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index 4f9a61b42b..13a371f086 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -1160,14 +1160,38 @@ implementation '.stab','.stabstr') ); + as_i386_pecoffwdosx_info : tasminfo = + ( + id : as_i386_pecoffwdosx; + idtxt : 'PECOFFWDOSX'; + asmbin : ''; + asmcmd : ''; + supported_target : target_i386_wdosx; + outputbinary : true; + allowdirect : false; + externals : true; + needar : false; + labelprefix_only_inside_procedure: false; + labelprefix : '.L'; + comment : ''; + secnames : ('', + '.text','.data','.bss', + '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata', + '.stab','.stabstr') + ); + initialization RegisterAssembler(as_i386_coff_info,TCoffAssembler); RegisterAssembler(as_i386_pecoff_info,TPECoffAssembler); + RegisterAssembler(as_i386_pecoffwdosx_info,TPECoffAssembler); end. { $Log$ - Revision 1.16 2001-09-17 21:29:12 peter + Revision 1.17 2002-04-04 18:38:30 carl + + added wdosx support (patch from Pavel) + + Revision 1.16 2001/09/17 21:29:12 peter * merged netbsd, fpu-overflow from fixes branch Revision 1.15 2001/05/06 17:13:23 jonas diff --git a/compiler/options.pas b/compiler/options.pas index 6d04e80236..ae9ecbb35f 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -123,7 +123,7 @@ end; procedure set_default_link_type; begin - if (target_info.target=target_i386_win32) then + if (target_info.target in [target_i386_win32,target_i386_wdosx]) then begin def_symbol('FPC_LINK_SMART'); undef_symbol('FPC_LINK_STATIC'); @@ -1646,7 +1646,10 @@ finalization end. { $Log$ - Revision 1.64 2001-12-03 21:48:42 peter + Revision 1.65 2002-04-04 18:39:45 carl + + added wdosx support (patch from Pavel) + + Revision 1.64 2001/12/03 21:48:42 peter * freemem change to value parameter * torddef low/high range changed to int64 diff --git a/compiler/pexports.pas b/compiler/pexports.pas index 9c6434e74a..b9f7c7ff50 100644 --- a/compiler/pexports.pas +++ b/compiler/pexports.pas @@ -96,7 +96,7 @@ implementation an underline } if InternalProcName[1]='_' then delete(InternalProcName,1,1) - else if (target_info.target=target_i386_win32) and UseDeffileForExport then + else if (target_info.target in [target_i386_win32,target_i386_wdosx]) and UseDeffileForExport then begin Message(parser_e_dlltool_unit_var_problem); Message(parser_e_dlltool_unit_var_problem2); @@ -118,7 +118,7 @@ implementation end; hp.options:=hp.options or eo_index; pt.free; - if target_info.target=target_i386_win32 then + if target_info.target in [target_i386_win32,target_i386_wdosx] then DefString:=srsym.realname+'='+InternalProcName+' @ '+tostr(hp.index) else DefString:=srsym.realname+'='+InternalProcName; {Index ignored!} @@ -173,7 +173,10 @@ end. { $Log$ - Revision 1.16 2001-11-02 22:58:04 peter + Revision 1.17 2002-04-04 18:41:07 carl + + added wdosx support (patch from Pavel) + + Revision 1.16 2001/11/02 22:58:04 peter * procsym definition rewrite Revision 1.15 2001/04/18 22:01:57 peter diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index c79e224bc3..7b798e3311 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -73,7 +73,7 @@ implementation end; DLLscanner.Free; { Recreate import section } - if (target_info.target=target_i386_win32) then + if (target_info.target in [target_i386_win32,target_i386_wdosx]) then begin if assigned(importssection)then importssection.clear @@ -98,7 +98,7 @@ implementation begin { regenerate the importssection for win32 } if assigned(importssection) and - (target_info.target=target_i386_win32) then + (target_info.target in [target_i386_win32,target_i386_wdosx]) then begin importsSection.clear; importlib.generatesmartlib; @@ -1181,7 +1181,7 @@ implementation { internal assembler uses rva for stabs info so it should work with relocated DLLs } if RelocSection and - (target_info.target=target_i386_win32) and + (target_info.target in [target_i386_win32,target_i386_wdosx]) and (target_info.assem<>as_i386_pecoff) then begin include(aktglobalswitches,cs_link_strip); @@ -1220,7 +1220,7 @@ implementation stringdispose(current_module.realmodulename); current_module.modulename:=stringdup(pattern); current_module.realmodulename:=stringdup(orgpattern); - if (target_info.target=target_i386_WIN32) then + if (target_info.target in [target_i386_WIN32,target_i386_wdosx]) then exportlib.preparelib(pattern); consume(_ID); if token=_LKLAMMER then @@ -1231,7 +1231,7 @@ implementation end; consume(_SEMICOLON); end - else if (target_info.target=target_i386_WIN32) then + else if (target_info.target in [target_i386_WIN32,target_i386_wdosx]) then exportlib.preparelib(current_module.modulename^); { global switches are read, so further changes aren't allowed } @@ -1305,7 +1305,7 @@ implementation { Add symbol to the exports section for win32 so smartlinking a DLL will include the edata section } if assigned(exportlib) and - (target_info.target=target_i386_win32) and + (target_info.target in [target_i386_win32,target_i386_wdosx]) and assigned(current_module._exports.first) then codesegment.concat(tai_const_symbol.create(exportlib.edatalabel)); @@ -1370,7 +1370,7 @@ implementation importlib.generatelib; if islibrary or - (target_info.target=target_i386_WIN32) or + (target_info.target in [target_i386_WIN32,target_i386_wdosx]) or (target_info.target=target_i386_NETWARE) then exportlib.generatelib; @@ -1428,7 +1428,10 @@ implementation end. { $Log$ - Revision 1.56 2002-04-02 17:11:29 peter + Revision 1.57 2002-04-04 18:42:49 carl + + added wdosx support (patch from Pavel) + + Revision 1.56 2002/04/02 17:11:29 peter * tlocation,treference update * LOC_CONSTANT added for better constant handling * secondadd splitted in multiple routines diff --git a/compiler/psub.pas b/compiler/psub.pas index a8a5fec062..9a36405ee7 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -303,9 +303,7 @@ implementation aktprocsym=nil. But in that case code=nil. hus we should check for code=nil, when we use aktprocsym.} - { set the framepointer to esp for assembler functions } - { but only if the are no local variables } - { already done in assembler_block } + { set the start offset to the start of the temp area in the stack } tg.setfirsttemp(procinfo^.firsttemp_offset); { ... and generate assembler } @@ -770,8 +768,8 @@ implementation Message(parser_e_syntax_error); consume_all_until(_SEMICOLON); end - else if islibrary or (target_info.target=target_i386_WIN32) - or (target_info.target=target_i386_Netware) then // AD + else if islibrary or (target_info.target in [target_i386_WIN32,target_i386_wdosx,target_i386_Netware]) + then // AD read_exports; end else break; @@ -819,7 +817,10 @@ implementation end. { $Log$ - Revision 1.45 2002-03-31 20:26:36 jonas + Revision 1.46 2002-04-04 18:45:19 carl + + added wdosx support (patch from Pavel) + + Revision 1.45 2002/03/31 20:26:36 jonas + a_loadfpu_* and a_loadmm_* methods in tcg * register allocation is now handled by a class and is mostly processor independent (+rgobj.pas and i386/rgcpu.pas)