t_wdosx.pas 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. {
  2. $Id$
  3. Copyright (c) 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 defines.inc}
  21. interface
  22. implementation
  23. uses
  24. {$ifdef Delphi}
  25. dmisc,
  26. {$else Delphi}
  27. dos,
  28. {$endif Delphi}
  29. cutils,cclasses,
  30. aasm,fmodule,globtype,globals,systems,verbose,
  31. symconst,symsym,
  32. script,gendef,
  33. cpubase,cpuasm,
  34. {$ifdef GDB}
  35. gdb,
  36. {$endif}
  37. import,export,link,t_win32;
  38. type
  39. timportlibwdosx=class(timportlibwin32)
  40. procedure GetDefExt(var N:longint;var P:pStr4);override;
  41. end;
  42. texportlibwdosx=texportlibwin32;
  43. tlinkerwdosx=class(tlinkerwin32)
  44. public
  45. function MakeExecutable:boolean;override;
  46. end;
  47. tDLLScannerWdosx=class(tDLLScannerWin32)
  48. public
  49. procedure GetDefExt(var N:longint;var P:pStr4);override;
  50. end;
  51. const
  52. DefaultDLLExtensions:array[1..2]of string[4]=('.WDL','.DLL');
  53. {*****************************************************************************
  54. TIMPORTLIBWDOSX
  55. *****************************************************************************}
  56. procedure timportlibwdosx.GetDefExt(var N:longint;var P:pStr4);
  57. begin
  58. N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
  59. pointer(P):=@DefaultDLLExtensions;
  60. end;
  61. {*****************************************************************************
  62. TLINKERWDOSX
  63. *****************************************************************************}
  64. function TLinkerWdosx.MakeExecutable:boolean;
  65. begin
  66. Result:=inherited;
  67. if Result then
  68. DoExec(FindUtil('stubit'),current_module.exefilename^,false,false);
  69. end;
  70. {****************************************************************************
  71. TDLLScannerWdosx
  72. ****************************************************************************}
  73. procedure tDLLScannerWdosx.GetDefExt(var N:longint;var P:pStr4);
  74. begin
  75. N:=sizeof(DefaultDLLExtensions)div sizeof(DefaultDLLExtensions[1]);
  76. pointer(P):=@DefaultDLLExtensions;
  77. end;
  78. {*****************************************************************************
  79. Initialize
  80. *****************************************************************************}
  81. const
  82. target_i386_wdosx_info : ttargetinfo =
  83. (
  84. target : target_i386_wdosx;
  85. name : 'WDOSX DOS extender';
  86. shortname : 'WDOSX';
  87. flags : [];
  88. cpu : cpu_i386;
  89. unit_env : 'WDOSXUNITS';
  90. extradefines : 'MSWINDOWS';
  91. sourceext : '.pp';
  92. pasext : '.pas';
  93. exeext : '.exe';
  94. defext : '.def';
  95. scriptext : '.bat';
  96. smartext : '.sld';
  97. unitext : '.ppd';
  98. unitlibext : '.ppl';
  99. asmext : '.sd';
  100. objext : '.od';
  101. resext : '.rc';
  102. resobjext : '.odr';
  103. sharedlibext : '.dll';
  104. staticlibext : '.ad';
  105. staticlibprefix : 'libp';
  106. sharedlibprefix : '';
  107. sharedClibext : '.dll';
  108. staticClibext : '.a';
  109. staticClibprefix : 'lib';
  110. sharedClibprefix : '';
  111. Cprefix : '_';
  112. newline : #13#10;
  113. dirsep : '\';
  114. files_case_relevent : false;
  115. assem : as_i386_pecoffwdosx;
  116. assemextern : as_i386_aswdosx;
  117. link : ld_i386_wdosx;
  118. linkextern : ld_i386_wdosx;
  119. ar : ar_gnu_arw;
  120. res : res_gnu_windres;
  121. script : script_dos;
  122. endian : endian_little;
  123. alignment :
  124. (
  125. procalign : 4;
  126. loopalign : 4;
  127. jumpalign : 0;
  128. constalignmin : 0;
  129. constalignmax : 4;
  130. varalignmin : 0;
  131. varalignmax : 4;
  132. localalignmin : 0;
  133. localalignmax : 4;
  134. paraalign : 4;
  135. recordalignmin : 0;
  136. recordalignmax : 2;
  137. maxCrecordalign : 16
  138. );
  139. first_parm_offset : 8;
  140. heapsize : 256*1024;
  141. stacksize : 32*1024*1024;
  142. DllScanSupported:true;
  143. use_function_relative_addresses : true
  144. );
  145. initialization
  146. RegisterLinker(ld_i386_wdosx,TLinkerWdosx);
  147. RegisterImport(target_i386_wdosx,TImportLibWdosx);
  148. RegisterExport(target_i386_wdosx,TExportLibWdosx);
  149. RegisterDLLScanner(target_i386_wdosx,TDLLScannerWdosx);
  150. {RegisterAr(ar_gnu_arw_info);}
  151. {RegisterRes(res_gnu_windres_info);}
  152. RegisterTarget(target_i386_wdosx_info);
  153. end.
  154. {
  155. $Log$
  156. Revision 1.4 2002-04-22 18:19:22 carl
  157. - remove use_bound_instruction field
  158. Revision 1.3 2002/04/20 21:43:18 carl
  159. * fix stack size for some targets
  160. + add offset to parameters from frame pointer info.
  161. - remove some unused stuff
  162. Revision 1.2 2002/04/15 19:16:57 carl
  163. - remove size_of_pointer field
  164. Revision 1.1 2002/04/04 18:09:49 carl
  165. + added wdosx patch from Pavel
  166. }