t_wdosx.pas 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. {
  2. $Id$
  3. Copyright (c) 2001-2002 Pavel ??????
  4. This unit implements support import,export,link routines
  5. for the (i386) WDOSX target
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit t_wdosx;
  20. {$i fpcdefs.inc}
  21. interface
  22. implementation
  23. uses
  24. cutils,
  25. fmodule,globals,systems,
  26. import,export,link,t_win32;
  27. type
  28. timportlibwdosx=class(timportlibwin32)
  29. procedure GetDefExt(var N:longint;var P:pStr4);override;
  30. end;
  31. texportlibwdosx=texportlibwin32;
  32. tlinkerwdosx=class(tlinkerwin32)
  33. public
  34. function MakeExecutable:boolean;override;
  35. end;
  36. tDLLScannerWdosx=class(tDLLScannerWin32)
  37. public
  38. procedure GetDefExt(var N:longint;var P:pStr4);override;
  39. end;
  40. const
  41. DefaultDLLExtensions:array[1..2]of string[4]=('.WDL','.DLL');
  42. {*****************************************************************************
  43. TIMPORTLIBWDOSX
  44. *****************************************************************************}
  45. procedure timportlibwdosx.GetDefExt(var N:longint;var P:pStr4);
  46. begin
  47. N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
  48. pointer(P):=@DefaultDLLExtensions;
  49. end;
  50. {*****************************************************************************
  51. TLINKERWDOSX
  52. *****************************************************************************}
  53. function TLinkerWdosx.MakeExecutable:boolean;
  54. begin
  55. Result:=inherited;
  56. if Result then
  57. DoExec(FindUtil('stubit'),current_module.exefilename^,false,false);
  58. end;
  59. {****************************************************************************
  60. TDLLScannerWdosx
  61. ****************************************************************************}
  62. procedure tDLLScannerWdosx.GetDefExt(var N:longint;var P:pStr4);
  63. begin
  64. N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
  65. pointer(P):=@DefaultDLLExtensions;
  66. end;
  67. {*****************************************************************************
  68. Initialize
  69. *****************************************************************************}
  70. const
  71. target_i386_wdosx_info : ttargetinfo =
  72. (
  73. target : target_i386_wdosx;
  74. name : 'WDOSX DOS extender';
  75. shortname : 'WDOSX';
  76. flags : [];
  77. cpu : cpu_i386;
  78. unit_env : 'WDOSXUNITS';
  79. extradefines : 'MSWINDOWS';
  80. sourceext : '.pp';
  81. pasext : '.pas';
  82. exeext : '.exe';
  83. defext : '.def';
  84. scriptext : '.bat';
  85. smartext : '.sld';
  86. unitext : '.ppd';
  87. unitlibext : '.ppl';
  88. asmext : '.sd';
  89. objext : '.od';
  90. resext : '.rc';
  91. resobjext : '.odr';
  92. sharedlibext : '.dll';
  93. staticlibext : '.ad';
  94. staticlibprefix : 'libp';
  95. sharedlibprefix : '';
  96. sharedClibext : '.dll';
  97. staticClibext : '.a';
  98. staticClibprefix : 'lib';
  99. sharedClibprefix : '';
  100. Cprefix : '_';
  101. newline : #13#10;
  102. dirsep : '\';
  103. files_case_relevent : false;
  104. assem : as_i386_pecoffwdosx;
  105. assemextern : as_i386_aswdosx;
  106. link : ld_i386_wdosx;
  107. linkextern : ld_i386_wdosx;
  108. ar : ar_gnu_arw;
  109. res : res_gnu_windres;
  110. script : script_dos;
  111. endian : endian_little;
  112. alignment :
  113. (
  114. procalign : 4;
  115. loopalign : 4;
  116. jumpalign : 0;
  117. constalignmin : 0;
  118. constalignmax : 4;
  119. varalignmin : 0;
  120. varalignmax : 4;
  121. localalignmin : 0;
  122. localalignmax : 4;
  123. paraalign : 4;
  124. recordalignmin : 0;
  125. recordalignmax : 2;
  126. maxCrecordalign : 16
  127. );
  128. first_parm_offset : 8;
  129. heapsize : 256*1024;
  130. stacksize : 32*1024*1024;
  131. DllScanSupported:true;
  132. use_function_relative_addresses : true
  133. );
  134. initialization
  135. RegisterLinker(ld_i386_wdosx,TLinkerWdosx);
  136. RegisterImport(target_i386_wdosx,TImportLibWdosx);
  137. RegisterExport(target_i386_wdosx,TExportLibWdosx);
  138. RegisterDLLScanner(target_i386_wdosx,TDLLScannerWdosx);
  139. {RegisterAr(ar_gnu_arw_info);}
  140. {RegisterRes(res_gnu_windres_info);}
  141. RegisterTarget(target_i386_wdosx_info);
  142. end.
  143. {
  144. $Log$
  145. Revision 1.8 2002-05-18 13:34:27 peter
  146. * readded missing revisions
  147. Revision 1.7 2002/05/16 19:46:53 carl
  148. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  149. + try to fix temp allocation (still in ifdef)
  150. + generic constructor calls
  151. + start of tassembler / tmodulebase class cleanup
  152. Revision 1.5 2002/05/12 16:53:18 peter
  153. * moved entry and exitcode to ncgutil and cgobj
  154. * foreach gets extra argument for passing local data to the
  155. iterator function
  156. * -CR checks also class typecasts at runtime by changing them
  157. into as
  158. * fixed compiler to cycle with the -CR option
  159. * fixed stabs with elf writer, finally the global variables can
  160. be watched
  161. * removed a lot of routines from cga unit and replaced them by
  162. calls to cgobj
  163. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  164. u32bit then the other is typecasted also to u32bit without giving
  165. a rangecheck warning/error.
  166. * fixed pascal calling method with reversing also the high tree in
  167. the parast, detected by tcalcst3 test
  168. Revision 1.4 2002/04/22 18:19:22 carl
  169. - remove use_bound_instruction field
  170. Revision 1.3 2002/04/20 21:43:18 carl
  171. * fix stack size for some targets
  172. + add offset to parameters from frame pointer info.
  173. - remove some unused stuff
  174. Revision 1.2 2002/04/15 19:16:57 carl
  175. - remove size_of_pointer field
  176. Revision 1.1 2002/04/04 18:09:49 carl
  177. + added wdosx patch from Pavel
  178. }