systems.pas 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967
  1. {
  2. $Id$
  3. Copyright (C) 1995,97 by Florian Klaempfl
  4. This unit contains information about the target systems supported
  5. (these are not processor specific)
  6. This progsam is free software; you can redistribute it and/or modify
  7. iu under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 3 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 systems;
  20. interface
  21. type
  22. tendian = (endian_little,endian_big);
  23. ttargetcpu=(no_cpu
  24. ,i386,m68k,alpha
  25. );
  26. tprocessors = (no_processor
  27. ,Class386,ClassP5,ClassP6
  28. ,MC68000,MC68100,MC68020
  29. );
  30. tsection=(sec_none,
  31. sec_code,sec_data,sec_bss,
  32. sec_idata2,sec_idata4,sec_idata5,sec_idata6,sec_idata7,sec_edata,
  33. sec_stab,sec_stabstr
  34. );
  35. type
  36. tasmmode= (asmmode_none
  37. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  38. ,asmmode_m68k_mot,asmmode_alpha_direct
  39. );
  40. const
  41. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  42. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  43. {$ifdef alpha} alphaasmmodecnt=1; {$else} alphaasmmodecnt=0; {$endif}
  44. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+Alphaasmmodecnt+1;
  45. type
  46. ttarget = (target_none
  47. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  48. target_i386_OS2,target_i386_Win32
  49. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  50. target_m68k_linux,target_m68k_PalmOS,target_alpha_linux
  51. );
  52. ttargetflags = (tf_needs_isconsole,tf_supports_stack_checking);
  53. const
  54. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  55. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  56. {$ifdef alpha} alphatargetcnt=1; {$else} alphatargetcnt=0; {$endif}
  57. targetcnt=i386targetcnt+m68ktargetcnt+alphatargetcnt+1;
  58. type
  59. tasm = (as_none
  60. ,as_i386_as,as_i386_as_aout,as_i386_asw,
  61. as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
  62. as_i386_tasm,as_i386_masm,
  63. as_i386_dbg,as_i386_coff,as_i386_pecoff
  64. ,as_m68k_as,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw,
  65. as_alpha_as
  66. );
  67. { binary assembler writers, needed to test for -a }
  68. const
  69. {$ifdef i386} i386asmcnt=11; {$else} i386asmcnt=0; {$endif}
  70. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  71. {$ifdef alpha} alphaasmcnt=1; {$else} alphaasmcnt=0; {$endif}
  72. asmcnt=i386asmcnt+m68kasmcnt+alphaasmcnt+1;
  73. binassem : set of tasm = [
  74. as_i386_dbg,as_i386_coff,as_i386_pecoff
  75. ];
  76. type
  77. tlink = (link_none
  78. ,link_i386_ld,link_i386_ldgo32v1,
  79. link_i386_ldgo32v2,link_i386_ldw,
  80. link_i386_ldos2
  81. ,link_m68k_ld,link_alpha_ld
  82. );
  83. const
  84. {$ifdef i386} i386linkcnt=5; {$else} i386linkcnt=0; {$endif}
  85. {$ifdef m68k} m68klinkcnt=1; {$else} m68klinkcnt=0; {$endif}
  86. {$ifdef alpha} alphalinkcnt=1; {$else} alphalinkcnt=0; {$endif}
  87. linkcnt=i386linkcnt+m68klinkcnt+alphalinkcnt+1;
  88. type
  89. tar = (ar_none
  90. ,ar_i386_ar,ar_i386_arw
  91. ,ar_m68k_ar,ar_alpha_ar
  92. );
  93. const
  94. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  95. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  96. {$ifdef alpha} alphaarcnt=1; {$else} alphaarcnt=0; {$endif}
  97. arcnt=i386arcnt+m68karcnt+alphaarcnt+1;
  98. type
  99. tres = (res_none
  100. ,res_i386_windres
  101. );
  102. const
  103. {$ifdef i386} i386rescnt=1; {$else} i386rescnt=0; {$endif}
  104. {$ifdef m68k} m68krescnt=0; {$else} m68krescnt=0; {$endif}
  105. {$ifdef alpha} alpharescnt=0; {$else} alpharescnt=0; {$endif}
  106. rescnt=i386rescnt+m68krescnt+alpharescnt+1;
  107. type
  108. tos = ( os_none,
  109. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  110. os_i386_Win32,
  111. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  112. os_m68k_PalmOS,os_alpha_linux
  113. );
  114. const
  115. i386oscnt=5;
  116. m68koscnt=5;
  117. alphaoscnt=1;
  118. oscnt=i386oscnt+m68koscnt+alphaoscnt+1;
  119. type
  120. tosinfo = packed record
  121. id : tos;
  122. name : string[30];
  123. shortname : string[8];
  124. sharedlibext : string[10];
  125. staticlibext,
  126. sourceext,
  127. pasext,
  128. exeext,
  129. defext,
  130. scriptext : string[4];
  131. libprefix : string[3];
  132. Cprefix : string[2];
  133. newline : string[2];
  134. endian : tendian;
  135. stackalignment : {longint this is a little overkill no ?? }byte;
  136. size_of_pointer : byte;
  137. size_of_longint : byte;
  138. use_bound_instruction : boolean;
  139. use_function_relative_addresses : boolean;
  140. end;
  141. tasminfo = packed record
  142. id : tasm;
  143. idtxt : string[8];
  144. asmbin : string[8];
  145. asmcmd : string[50];
  146. allowdirect,
  147. externals,
  148. needar : boolean;
  149. labelprefix : string[2];
  150. comment : string[2];
  151. secnames : array[tsection] of string[20];
  152. end;
  153. tlinkinfo = packed record
  154. id : tlink;
  155. linkbin : string[8];
  156. linkcmd : string[127];
  157. binders : word;
  158. bindbin : array[1..2]of string[8];
  159. bindcmd : array[1..2]of string[127];
  160. stripopt : string[2];
  161. stripbind : boolean; { Strip symbols in binder? }
  162. libpathprefix : string[13];
  163. libpathsuffix : string[2];
  164. groupstart : string[8];
  165. groupend : string[2];
  166. inputstart : string[8];
  167. inputend : string[2];
  168. libprefix : string[2];
  169. end;
  170. tarinfo = packed record
  171. id : tar;
  172. arbin : string[8];
  173. arcmd : string[50];
  174. end;
  175. tresinfo = packed record
  176. id : tres;
  177. resbin : string[8];
  178. rescmd : string[50];
  179. end;
  180. ttargetinfo = packed record
  181. target : ttarget;
  182. flags : set of ttargetflags;
  183. cpu : ttargetcpu;
  184. short_name : string[8];
  185. unit_env : string[12];
  186. system_unit : string[8];
  187. smartext,
  188. unitext,
  189. unitlibext,
  190. asmext,
  191. objext,
  192. resext,
  193. resobjext,
  194. exeext : string[4];
  195. os : tos;
  196. link : tlink;
  197. assem : tasm;
  198. assemsrc : tasm; { default source writing assembler }
  199. ar : tar;
  200. res : tres;
  201. heapsize,
  202. maxheapsize,
  203. stacksize : longint;
  204. end;
  205. tasmmodeinfo=packed record
  206. id : tasmmode;
  207. idtxt : string[8];
  208. end;
  209. var
  210. target_cpu : ttargetcpu;
  211. target_info : ttargetinfo;
  212. target_os : tosinfo;
  213. target_asm : tasminfo;
  214. target_link : tlinkinfo;
  215. target_ar : tarinfo;
  216. target_res : tresinfo;
  217. target_path : string[12]; { for rtl/<X>/,fcl/<X>/, etc. }
  218. source_os : tosinfo;
  219. function set_target_os(t:tos):boolean;
  220. function set_target_asm(t:tasm):boolean;
  221. function set_target_link(t:tlink):boolean;
  222. function set_target_ar(t:tar):boolean;
  223. function set_target_res(t:tres):boolean;
  224. function set_target_info(t:ttarget):boolean;
  225. function set_string_target(s : string) : boolean;
  226. function set_string_asm(s : string) : boolean;
  227. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  228. procedure InitSystems;
  229. implementation
  230. const
  231. {****************************************************************************
  232. OS Info
  233. ****************************************************************************}
  234. os_infos : array[1..oscnt] of tosinfo = (
  235. (
  236. id : os_none;
  237. name : 'No operating system';
  238. shortname : 'none'
  239. ),
  240. (
  241. id : os_i386_go32v1;
  242. name : 'GO32 V1 DOS extender';
  243. shortname : 'go32v1';
  244. sharedlibext : '.dll';
  245. staticlibext : '.a';
  246. sourceext : '.pp';
  247. pasext : '.pas';
  248. exeext : ''; { No .exe, the linker only output a.out ! }
  249. defext : '.def';
  250. scriptext : '.bat';
  251. libprefix : '';
  252. Cprefix : '_';
  253. newline : #13#10;
  254. endian : endian_little;
  255. stackalignment : 2;
  256. size_of_pointer : 4;
  257. size_of_longint : 4;
  258. use_bound_instruction : false;
  259. use_function_relative_addresses : true
  260. ),
  261. (
  262. id : os_i386_go32v2;
  263. name : 'GO32 V2 DOS extender';
  264. shortname : 'go32v2';
  265. sharedlibext : '.dll';
  266. staticlibext : '.a';
  267. sourceext : '.pp';
  268. pasext : '.pas';
  269. exeext : '.exe';
  270. defext : '.def';
  271. scriptext : '.bat';
  272. libprefix : '';
  273. Cprefix : '_';
  274. newline : #13#10;
  275. endian : endian_little;
  276. stackalignment : 2;
  277. size_of_pointer : 4;
  278. size_of_longint : 4;
  279. use_bound_instruction : false;
  280. use_function_relative_addresses : true
  281. ),
  282. (
  283. id : os_i386_linux;
  284. name : 'Linux for i386';
  285. shortname : 'linux';
  286. sharedlibext : '.so';
  287. staticlibext : '.a';
  288. sourceext : '.pp';
  289. pasext : '.pas';
  290. exeext : '';
  291. defext : '.def';
  292. scriptext : '.sh';
  293. libprefix : 'lib';
  294. Cprefix : '';
  295. newline : #10;
  296. endian : endian_little;
  297. stackalignment : 4;
  298. size_of_pointer : 4;
  299. size_of_longint : 4;
  300. use_bound_instruction : false;
  301. use_function_relative_addresses : true
  302. ),
  303. (
  304. id : os_i386_os2;
  305. name : 'OS/2 via EMX';
  306. shortname : 'os2';
  307. sharedlibext : '.ao2';
  308. staticlibext : '.ao2';
  309. sourceext : '.pas';
  310. pasext : '.pp';
  311. exeext : '.exe';
  312. defext : '.def';
  313. scriptext : '.cmd';
  314. libprefix : '';
  315. Cprefix : '_';
  316. newline : #13#10;
  317. endian : endian_little;
  318. stackalignment : 2;
  319. size_of_pointer : 4;
  320. size_of_longint : 4;
  321. use_bound_instruction : false;
  322. use_function_relative_addresses : false
  323. ),
  324. (
  325. id : os_i386_win32;
  326. name : 'Win32 for i386';
  327. shortname : 'win32';
  328. sharedlibext : '.dll';
  329. staticlibext : '.aw';
  330. sourceext : '.pp';
  331. pasext : '.pas';
  332. exeext : '.exe';
  333. defext : '.def';
  334. scriptext : '.bat';
  335. libprefix : 'lib';
  336. Cprefix : '_';
  337. newline : #13#10;
  338. endian : endian_little;
  339. stackalignment : 4;
  340. size_of_pointer : 4;
  341. size_of_longint : 4;
  342. use_bound_instruction : false;
  343. use_function_relative_addresses : true
  344. ),
  345. (
  346. id : os_m68k_amiga;
  347. name : 'Commodore Amiga';
  348. shortname : 'amiga';
  349. sharedlibext : '.library';
  350. staticlibext : '.a';
  351. sourceext : '.pp';
  352. pasext : '.pas';
  353. exeext : '';
  354. defext : '';
  355. scriptext : '';
  356. libprefix : '';
  357. Cprefix : '_';
  358. newline : #10;
  359. endian : endian_big;
  360. stackalignment : 2;
  361. size_of_pointer : 4;
  362. size_of_longint : 4;
  363. use_bound_instruction : false;
  364. use_function_relative_addresses : false
  365. ),
  366. (
  367. id : os_m68k_atari;
  368. name : 'Atari ST/STE';
  369. shortname : 'atari';
  370. sharedlibext : '.dll';
  371. staticlibext : '.a';
  372. sourceext : '.pp';
  373. pasext : '.pas';
  374. exeext : '.tpp';
  375. defext : '';
  376. scriptext : '';
  377. libprefix : '';
  378. Cprefix : '_';
  379. newline : #10;
  380. endian : endian_big;
  381. stackalignment : 2;
  382. size_of_pointer : 4;
  383. size_of_longint : 4;
  384. use_bound_instruction : false;
  385. use_function_relative_addresses : false
  386. ),
  387. (
  388. id : os_m68k_mac;
  389. name : 'Macintosh m68k';
  390. shortname : 'mac';
  391. sharedlibext : '.dll';
  392. staticlibext : '.a';
  393. sourceext : '.pp';
  394. pasext : '.pas';
  395. exeext : '.tpp';
  396. defext : '';
  397. scriptext : '';
  398. libprefix : '';
  399. Cprefix : '_';
  400. newline : #13;
  401. endian : endian_big;
  402. stackalignment : 2;
  403. size_of_pointer : 4;
  404. size_of_longint : 4;
  405. use_bound_instruction : false;
  406. use_function_relative_addresses : false
  407. ),
  408. (
  409. id : os_m68k_linux;
  410. name : 'Linux for m68k';
  411. shortname : 'linux';
  412. sharedlibext : '.so';
  413. staticlibext : '.a';
  414. sourceext : '.pp';
  415. pasext : '.pas';
  416. exeext : '';
  417. defext : '';
  418. scriptext : '.sh';
  419. libprefix : 'lib';
  420. Cprefix : '';
  421. newline : #10;
  422. endian : endian_big;
  423. stackalignment : 2;
  424. size_of_pointer : 4;
  425. size_of_longint : 4;
  426. use_bound_instruction : false;
  427. use_function_relative_addresses : true
  428. ),
  429. (
  430. id : os_m68k_palmos;
  431. name : 'PalmOS';
  432. shortname : 'palmos';
  433. sharedlibext : '.so';
  434. staticlibext : '.a';
  435. sourceext : '.pp';
  436. pasext : '.pas';
  437. exeext : '';
  438. defext : '';
  439. scriptext : '.sh';
  440. libprefix : 'lib';
  441. Cprefix : '_';
  442. newline : #10;
  443. endian : endian_big;
  444. stackalignment : 2;
  445. size_of_pointer : 4;
  446. size_of_longint : 4;
  447. use_bound_instruction : false;
  448. use_function_relative_addresses : false
  449. ),
  450. (
  451. id : os_alpha_linux;
  452. name : 'Linux for Alpha';
  453. shortname : 'linux';
  454. sharedlibext : '.so';
  455. staticlibext : '.a';
  456. sourceext : '.pp';
  457. pasext : '.pas';
  458. exeext : '';
  459. defext : '.def';
  460. scriptext : '.sh';
  461. libprefix : 'lib';
  462. Cprefix : '';
  463. newline : #10;
  464. endian : endian_little;
  465. stackalignment : 8;
  466. size_of_pointer : 8;
  467. size_of_longint : 4;
  468. use_bound_instruction : false;
  469. use_function_relative_addresses : true
  470. )
  471. );
  472. {****************************************************************************
  473. Assembler Info
  474. ****************************************************************************}
  475. as_infos : array[1..asmcnt] of tasminfo = (
  476. (
  477. id : as_none;
  478. idtxt : 'no'
  479. )
  480. {$ifdef i386}
  481. ,(
  482. id : as_i386_as;
  483. idtxt : 'AS';
  484. asmbin : 'as';
  485. asmcmd : '-o $OBJ $ASM';
  486. allowdirect : true;
  487. externals : false;
  488. needar : true;
  489. labelprefix : '.L';
  490. comment : '# ';
  491. secnames : ('',
  492. '.text','.data','.bss',
  493. '','','','','','',
  494. '.stab','.stabstr')
  495. )
  496. ,(
  497. id : as_i386_as_aout;
  498. idtxt : 'AS_AOUT';
  499. asmbin : 'as';
  500. asmcmd : '-o $OBJ $ASM';
  501. allowdirect : true;
  502. externals : false;
  503. needar : true;
  504. labelprefix : 'L';
  505. comment : '# ';
  506. secnames : ('',
  507. '.text','.data','.bss',
  508. '','','','','','',
  509. '.stab','.stabstr')
  510. )
  511. ,(
  512. id : as_i386_asw;
  513. idtxt : 'ASW';
  514. asmbin : 'asw';
  515. asmcmd : '-o $OBJ $ASM';
  516. allowdirect : true;
  517. externals : false;
  518. needar : true;
  519. labelprefix : '.L';
  520. comment : '# ';
  521. secnames : ('',
  522. '.text','.data','.section .bss',
  523. '.section .idata$2','.section .idata$4','.section .idata$5',
  524. '.section .idata$6','.section .idata$7','.section .edata',
  525. '.stab','.stabstr')
  526. )
  527. ,(
  528. id : as_i386_nasmcoff;
  529. idtxt : 'NASMCOFF';
  530. asmbin : 'nasm';
  531. asmcmd : '-f coff -o $OBJ $ASM';
  532. allowdirect : true;
  533. externals : true;
  534. needar : true;
  535. labelprefix : 'L';
  536. comment : '; ';
  537. secnames : ('',
  538. '.text','.data','.bss',
  539. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  540. '.stab','.stabstr')
  541. )
  542. ,(
  543. id : as_i386_nasmelf;
  544. idtxt : 'NASMELF';
  545. asmbin : 'nasm';
  546. asmcmd : '-f elf -o $OBJ $ASM';
  547. allowdirect : true;
  548. externals : true;
  549. needar : true;
  550. labelprefix : 'L';
  551. comment : '; ';
  552. secnames : ('',
  553. '.text','.data','.bss',
  554. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  555. '.stab','.stabstr')
  556. )
  557. ,(
  558. id : as_i386_nasmobj;
  559. idtxt : 'NASMOBJ';
  560. asmbin : 'nasm';
  561. asmcmd : '-f obj -o $OBJ $ASM';
  562. allowdirect : true;
  563. externals : true;
  564. needar : true;
  565. labelprefix : 'L';
  566. comment : '; ';
  567. secnames : ('',
  568. '.text','.data','.bss',
  569. '.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
  570. '.stab','.stabstr')
  571. )
  572. ,(
  573. id : as_i386_tasm;
  574. idtxt : 'TASM';
  575. asmbin : 'tasm';
  576. asmcmd : '/m2 $ASM $OBJ';
  577. allowdirect : true;
  578. externals : true;
  579. needar : true;
  580. labelprefix : '@@';
  581. comment : '; ';
  582. secnames : ('',
  583. 'CODE','DATA','BSS',
  584. '','','','','','',
  585. '','')
  586. )
  587. ,(
  588. id : as_i386_masm;
  589. idtxt : 'MASM';
  590. asmbin : 'masm';
  591. asmcmd : '$ASM $OBJ';
  592. allowdirect : true;
  593. externals : true;
  594. needar : true;
  595. labelprefix : '.L';
  596. comment : '; ';
  597. secnames : ('',
  598. 'CODE','DATA','BSS',
  599. '','','','','','',
  600. '','')
  601. )
  602. ,(
  603. id : as_i386_dbg;
  604. idtxt : 'DBG';
  605. asmbin : '';
  606. asmcmd : '';
  607. allowdirect : false;
  608. externals : true;
  609. needar : false;
  610. labelprefix : 'L';
  611. comment : '';
  612. secnames : ('',
  613. '.text','.data','.bss',
  614. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  615. '.stab','.stabstr')
  616. )
  617. ,(
  618. id : as_i386_coff;
  619. idtxt : 'COFF';
  620. asmbin : '';
  621. asmcmd : '';
  622. allowdirect : false;
  623. externals : true;
  624. needar : false;
  625. labelprefix : '.L';
  626. comment : '';
  627. secnames : ('',
  628. '.text','.data','.bss',
  629. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  630. '.stab','.stabstr')
  631. )
  632. ,(
  633. id : as_i386_pecoff;
  634. idtxt : 'PECOFF';
  635. asmbin : '';
  636. asmcmd : '';
  637. allowdirect : false;
  638. externals : true;
  639. needar : false;
  640. labelprefix : '.L';
  641. comment : '';
  642. secnames : ('',
  643. '.text','.data','.bss',
  644. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  645. '.stab','.stabstr')
  646. )
  647. {$endif i386}
  648. {$ifdef m68k}
  649. ,(
  650. id : as_m68k_as;
  651. idtxt : 'AS';
  652. asmbin : 'as';
  653. asmcmd : '-o $OBJ $ASM';
  654. allowdirect : true;
  655. externals : false;
  656. needar : true;
  657. labelprefix : '.L';
  658. comment : '# ';
  659. secnames : ('',
  660. '.text','.data','.bss',
  661. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  662. '.stab','.stabstr')
  663. )
  664. ,(
  665. id : as_m68k_gas;
  666. idtxt : 'GAS';
  667. asmbin : 'as68k'; { Gas for the Amiga}
  668. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  669. allowdirect : true;
  670. externals : false;
  671. needar : true;
  672. labelprefix : '.L';
  673. comment : '| ';
  674. secnames : ('',
  675. '.text','.data','.bss',
  676. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  677. '.stab','.stabstr')
  678. )
  679. ,(
  680. id : as_m68k_mit;
  681. idtxt : 'MIT';
  682. asmbin : '';
  683. asmcmd : '-o $OBJ $ASM';
  684. allowdirect : true;
  685. externals : false;
  686. needar : true;
  687. labelprefix : '.L';
  688. comment : '| ';
  689. secnames : ('',
  690. '.text','.data','.bss',
  691. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  692. '.stab','.stabstr')
  693. )
  694. ,(
  695. id : as_m68k_mot;
  696. idtxt : 'MOT';
  697. asmbin : '';
  698. asmcmd : '-o $OBJ $ASM';
  699. allowdirect : true;
  700. externals : false;
  701. needar : true;
  702. labelprefix : '__L';
  703. comment : '| ';
  704. secnames : ('',
  705. '.text','.data','.bss',
  706. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  707. '.stab','.stabstr')
  708. )
  709. ,(
  710. id : as_m68k_mpw;
  711. idtxt : 'MPW';
  712. asmbin : '';
  713. asmcmd : '-model far -o $OBJ $ASM';
  714. allowdirect : true;
  715. externals : false;
  716. needar : true;
  717. labelprefix : '__L';
  718. comment : '| ';
  719. secnames : ('',
  720. '.text','.data','.bss',
  721. '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
  722. '.stab','.stabstr')
  723. )
  724. {$endif m68k}
  725. {$ifdef alpha}
  726. ,(
  727. id : as_alpha_as;
  728. idtxt : 'AS';
  729. asmbin : 'as';
  730. asmcmd : '-o $OBJ $ASM';
  731. allowdirect : true;
  732. externals : false;
  733. needar : true;
  734. labelprefix : '.L';
  735. comment : '# ';
  736. secnames : ('',
  737. '.text','.data','.bss',
  738. '','','','','','',
  739. '.stab','.stabstr')
  740. )
  741. {$endif}
  742. );
  743. {****************************************************************************
  744. Linker Info
  745. ****************************************************************************}
  746. link_infos : array[1..linkcnt] of tlinkinfo = (
  747. (
  748. id : link_none
  749. )
  750. {$ifdef i386}
  751. ,(
  752. id : link_i386_ld;
  753. linkbin : 'ld';
  754. linkcmd : '$OPT -o $EXE $RES';
  755. binders : 0;
  756. bindbin : ('','');
  757. bindcmd : ('','');
  758. stripopt : '-s';
  759. stripbind : false;
  760. libpathprefix : 'SEARCH_DIR(';
  761. libpathsuffix : ')';
  762. groupstart : 'GROUP(';
  763. groupend : ')';
  764. inputstart : 'INPUT(';
  765. inputend : ')';
  766. libprefix : '-l'
  767. )
  768. ,(
  769. id : link_i386_ldgo32v1;
  770. linkbin : 'ld';
  771. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  772. binders : 1;
  773. bindbin : ('aout2exe','');
  774. bindcmd : ('$EXE','');
  775. stripopt : '-s';
  776. stripbind : false;
  777. libpathprefix : '-L';
  778. libpathsuffix : '';
  779. groupstart : '-(';
  780. groupend : '-)';
  781. inputstart : '';
  782. inputend : '';
  783. libprefix : '-l'
  784. )
  785. ,(
  786. id : link_i386_ldgo32v2;
  787. linkbin : 'ld';
  788. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  789. binders:0;
  790. bindbin : ('','');
  791. bindcmd : ('','');
  792. stripopt : '-s';
  793. stripbind : false;
  794. libpathprefix : '-L';
  795. libpathsuffix : '';
  796. groupstart : '-(';
  797. groupend : '-)';
  798. inputstart : '';
  799. inputend : '';
  800. libprefix : '-l'
  801. )
  802. ,(
  803. id : link_i386_ldw;
  804. linkbin : 'ldw';
  805. linkcmd : '$OPT -o $EXE $RES';
  806. binders : 0;
  807. bindbin : ('dlltool','ldw');
  808. bindcmd : ('--as asw.exe --dllname $EXE --output-exp exp.$$$',
  809. '-s $OPT -o $EXE $RES exp.$$$');
  810. stripopt : '-s';
  811. stripbind : false;
  812. libpathprefix : 'SEARCH_DIR(';
  813. libpathsuffix : ')';
  814. groupstart : 'GROUP(';
  815. groupend : ')';
  816. inputstart : 'INPUT(';
  817. inputend : ')';
  818. libprefix : '-l'
  819. )
  820. ,(
  821. id : link_i386_ldos2;
  822. linkbin : 'ld'; { Os/2 }
  823. linkcmd : '-o $EXE @$RES';
  824. binders : 1;
  825. bindbin : ('emxbind','');
  826. bindcmd : ('-b $STRIP -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB',
  827. '');
  828. stripopt : '-s';
  829. stripbind : true;
  830. libpathprefix : '-L';
  831. libpathsuffix : '';
  832. groupstart : ''; {Linker is too primitive...}
  833. groupend : '';
  834. inputstart : '';
  835. inputend : '';
  836. libprefix : '-l'
  837. )
  838. {$endif i386}
  839. {$ifdef m68k}
  840. ,(
  841. id : link_m68k_ld;
  842. linkbin : 'ld';
  843. linkcmd : '$OPT -o $EXE $RES';
  844. binders:0;
  845. bindbin : ('','');
  846. bindcmd : ('','');
  847. stripopt : '-s';
  848. stripbind : false;
  849. libpathprefix : 'SEARCH_DIR(';
  850. libpathsuffix : ')';
  851. groupstart : 'GROUP(';
  852. groupend : ')';
  853. inputstart : 'INPUT(';
  854. inputend : ')';
  855. libprefix : '-l'
  856. )
  857. {$endif m68k}
  858. {$ifdef alpha}
  859. ,(
  860. id : link_alpha_ld;
  861. linkbin : 'ld';
  862. linkcmd : '$OPT -o $EXE $RES';
  863. binders : 0;
  864. bindbin : ('','');
  865. bindcmd : ('','');
  866. stripopt : '-s';
  867. stripbind : false;
  868. libpathprefix : 'SEARCH_DIR(';
  869. libpathsuffix : ')';
  870. groupstart : 'GROUP(';
  871. groupend : ')';
  872. inputstart : 'INPUT(';
  873. inputend : ')';
  874. libprefix : '-l'
  875. )
  876. {$endif}
  877. );
  878. {****************************************************************************
  879. Ar Info
  880. ****************************************************************************}
  881. ar_infos : array[1..arcnt] of tarinfo = (
  882. (
  883. id : ar_none
  884. )
  885. {$ifdef i386}
  886. ,(
  887. id : ar_i386_ar;
  888. arbin : 'ar';
  889. arcmd : 'rs $LIB $FILES'
  890. ),
  891. (
  892. id : ar_i386_arw;
  893. arbin : 'arw';
  894. arcmd : 'rs $LIB $FILES'
  895. )
  896. {$endif i386}
  897. {$ifdef m68k}
  898. ,(
  899. id : ar_m68k_ar;
  900. arbin : 'ar';
  901. arcmd : 'rs $LIB $FILES'
  902. )
  903. {$endif m68k}
  904. {$ifdef alpha}
  905. ,(
  906. id : ar_alha_ar;
  907. arbin : 'ar';
  908. arcmd : 'rs $LIB $FILES'
  909. )
  910. {$endif}
  911. );
  912. {****************************************************************************
  913. Res Info
  914. ****************************************************************************}
  915. res_infos : array[1..rescnt] of tresinfo = (
  916. (
  917. id : res_none
  918. )
  919. {$ifdef i386}
  920. ,(
  921. id : res_i386_windres;
  922. resbin : 'windres';
  923. rescmd : '--include $INC -O coff -o $OBJ $RES'
  924. )
  925. {$endif i386}
  926. );
  927. {****************************************************************************
  928. Targets Info
  929. ****************************************************************************}
  930. target_infos : array[1..targetcnt] of ttargetinfo = (
  931. (
  932. target : target_none;
  933. flags : [];
  934. cpu : no_cpu;
  935. short_name : 'notarget'
  936. )
  937. {$ifdef i386}
  938. ,(
  939. target : target_i386_GO32V1;
  940. flags : [];
  941. cpu : i386;
  942. short_name : 'GO32V1';
  943. unit_env : 'GO32V1UNITS';
  944. system_unit : 'SYSTEM';
  945. smartext : '.sl';
  946. unitext : '.pp1';
  947. unitlibext : '.ppl';
  948. asmext : '.s1';
  949. objext : '.o1';
  950. resext : '.res';
  951. resobjext : '.o1r';
  952. exeext : ''; { The linker produces a.out }
  953. os : os_i386_GO32V1;
  954. link : link_i386_ldgo32v1;
  955. assem : as_i386_as;
  956. assemsrc : as_i386_as;
  957. ar : ar_i386_ar;
  958. res : res_none;
  959. heapsize : 2048*1024;
  960. maxheapsize : 32768*1024;
  961. stacksize : 16384
  962. ),
  963. (
  964. target : target_i386_GO32V2;
  965. flags : [];
  966. cpu : i386;
  967. short_name : 'GO32V2';
  968. unit_env : 'GO32V2UNITS';
  969. system_unit : 'SYSTEM';
  970. smartext : '.sl';
  971. unitext : '.ppu';
  972. unitlibext : '.ppl';
  973. asmext : '.s';
  974. objext : '.o';
  975. resext : '.res';
  976. resobjext : '.or';
  977. exeext : '.exe';
  978. os : os_i386_GO32V2;
  979. link : link_i386_ldgo32v2;
  980. assem : as_i386_coff;
  981. assemsrc : as_i386_as;
  982. ar : ar_i386_ar;
  983. res : res_none;
  984. heapsize : 2048*1024;
  985. maxheapsize : 32768*1024;
  986. stacksize : 16384
  987. ),
  988. (
  989. target : target_i386_LINUX;
  990. flags : [];
  991. cpu : i386;
  992. short_name : 'LINUX';
  993. unit_env : 'LINUXUNITS';
  994. system_unit : 'syslinux';
  995. smartext : '.sl';
  996. unitext : '.ppu';
  997. unitlibext : '.ppl';
  998. asmext : '.s';
  999. objext : '.o';
  1000. resext : '.res';
  1001. resobjext : '.or';
  1002. exeext : '';
  1003. os : os_i386_Linux;
  1004. link : link_i386_ld;
  1005. assem : as_i386_as;
  1006. assemsrc : as_i386_as;
  1007. ar : ar_i386_ar;
  1008. res : res_none;
  1009. heapsize : 256*1024;
  1010. maxheapsize : 32768*1024;
  1011. stacksize : 8192
  1012. ),
  1013. (
  1014. target : target_i386_OS2;
  1015. flags : [];
  1016. cpu : i386;
  1017. short_name : 'OS2';
  1018. unit_env : 'OS2UNITS';
  1019. system_unit : 'SYSOS2';
  1020. smartext : '.sl';
  1021. unitext : '.ppo';
  1022. unitlibext : '.ppl';
  1023. asmext : '.so2';
  1024. objext : '.oo2';
  1025. resext : '.res';
  1026. resobjext : '.oor';
  1027. exeext : ''; { The linker produces a.out }
  1028. os : os_i386_OS2;
  1029. link : link_i386_ldos2;
  1030. assem : as_i386_as_aout;
  1031. assemsrc : as_i386_as_aout;
  1032. ar : ar_i386_ar;
  1033. res : res_none;
  1034. heapsize : 256*1024;
  1035. maxheapsize : 32768*1024;
  1036. stacksize : 32768
  1037. ),
  1038. (
  1039. target : target_i386_WIN32;
  1040. flags : [];
  1041. cpu : i386;
  1042. short_name : 'WIN32';
  1043. unit_env : 'WIN32UNITS';
  1044. system_unit : 'SYSWIN32';
  1045. smartext : '.slw';
  1046. unitext : '.ppw';
  1047. unitlibext : '.ppl';
  1048. asmext : '.sw';
  1049. objext : '.ow';
  1050. resext : '.rc';
  1051. resobjext : '.owr';
  1052. exeext : '.exe';
  1053. os : os_i386_Win32;
  1054. link : link_i386_ldw;
  1055. assem : as_i386_pecoff;
  1056. assemsrc : as_i386_asw;
  1057. ar : ar_i386_arw;
  1058. res : res_i386_windres;
  1059. heapsize : 256*1024;
  1060. maxheapsize : 32*1024*1024;
  1061. stacksize : 32*1024*1024
  1062. )
  1063. {$endif i386}
  1064. {$ifdef m68k}
  1065. ,(
  1066. target : target_m68k_Amiga;
  1067. flags : [];
  1068. cpu : m68k;
  1069. short_name : 'AMIGA';
  1070. unit_env : '';
  1071. system_unit : 'sysamiga';
  1072. smartext : '.sl';
  1073. unitext : '.ppa';
  1074. unitlibext : '.ppl';
  1075. asmext : '.asm';
  1076. objext : '.o';
  1077. resext : '.res';
  1078. resobjext : '.or';
  1079. exeext : '';
  1080. os : os_m68k_Amiga;
  1081. link : link_m68k_ld;
  1082. assem : as_m68k_as;
  1083. assemsrc : as_m68k_as;
  1084. ar : ar_m68k_ar;
  1085. res : res_none;
  1086. heapsize : 128*1024;
  1087. maxheapsize : 32768*1024;
  1088. stacksize : 8192
  1089. ),
  1090. (
  1091. target : target_m68k_Atari;
  1092. flags : [];
  1093. cpu : m68k;
  1094. short_name : 'ATARI';
  1095. unit_env : '';
  1096. system_unit : 'SYSATARI';
  1097. smartext : '.sl';
  1098. unitext : '.ppt';
  1099. unitlibext : '.ppl';
  1100. asmext : '.s';
  1101. objext : '.o';
  1102. resext : '.res';
  1103. resobjext : '.or';
  1104. exeext : '.ttp';
  1105. os : os_m68k_Atari;
  1106. link : link_m68k_ld;
  1107. assem : as_m68k_as;
  1108. assemsrc : as_m68k_as;
  1109. ar : ar_m68k_ar;
  1110. res : res_none;
  1111. heapsize : 16*1024;
  1112. maxheapsize : 32768*1024;
  1113. stacksize : 8192
  1114. ),
  1115. (
  1116. target : target_m68k_Mac;
  1117. flags : [];
  1118. cpu : m68k;
  1119. short_name : 'MACOS';
  1120. unit_env : '';
  1121. system_unit : 'sysmac';
  1122. smartext : '.sl';
  1123. unitext : '.ppt';
  1124. unitlibext : '.ppl';
  1125. asmext : '.a';
  1126. objext : '.o';
  1127. resext : '.res';
  1128. resobjext : '.or';
  1129. exeext : '';
  1130. os : os_m68k_Mac;
  1131. link : link_m68k_ld;
  1132. assem : as_m68k_mpw;
  1133. assemsrc : as_m68k_mpw;
  1134. ar : ar_m68k_ar;
  1135. res : res_none;
  1136. heapsize : 128*1024;
  1137. maxheapsize : 32768*1024;
  1138. stacksize : 8192
  1139. ),
  1140. (
  1141. target : target_m68k_linux;
  1142. flags : [];
  1143. cpu : m68k;
  1144. short_name : 'LINUX';
  1145. unit_env : 'LINUXUNITS';
  1146. system_unit : 'syslinux';
  1147. smartext : '.sl';
  1148. unitext : '.ppu';
  1149. unitlibext : '.ppl';
  1150. asmext : '.s';
  1151. objext : '.o';
  1152. resext : '.res';
  1153. resobjext : '.or';
  1154. exeext : '';
  1155. os : os_m68k_Linux;
  1156. link : link_m68k_ld;
  1157. assem : as_m68k_as;
  1158. assemsrc : as_m68k_as;
  1159. ar : ar_m68k_ar;
  1160. res : res_none;
  1161. heapsize : 128*1024;
  1162. maxheapsize : 32768*1024;
  1163. stacksize : 8192
  1164. ),
  1165. (
  1166. target : target_m68k_PalmOS;
  1167. flags : [];
  1168. cpu : m68k;
  1169. short_name : 'PALMOS';
  1170. unit_env : 'PALMUNITS';
  1171. system_unit : 'syspalm';
  1172. smartext : '.sl';
  1173. unitext : '.ppu';
  1174. unitlibext : '.ppl';
  1175. asmext : '.s';
  1176. objext : '.o';
  1177. resext : '.res';
  1178. resobjext : '.or';
  1179. exeext : '';
  1180. os : os_m68k_PalmOS;
  1181. link : link_m68k_ld;
  1182. assem : as_m68k_as;
  1183. assemsrc : as_m68k_as;
  1184. ar : ar_m68k_ar;
  1185. res : res_none;
  1186. heapsize : 128*1024;
  1187. maxheapsize : 32768*1024;
  1188. stacksize : 8192
  1189. )
  1190. {$endif m68k}
  1191. {$ifdef alpha}
  1192. (
  1193. target : target_alpha_LINUX;
  1194. flags : [];
  1195. cpu : alpha;
  1196. short_name : 'LINUX';
  1197. unit_env : 'LINUXUNITS';
  1198. system_unit : 'syslinux';
  1199. smartext : '.sl';
  1200. unitext : '.ppu';
  1201. unitlibext : '.ppl';
  1202. asmext : '.s';
  1203. objext : '.o';
  1204. resext : '.res';
  1205. resobjext : '.or';
  1206. exeext : '';
  1207. os : os_alpha_Linux;
  1208. link : link_alpha_ld;
  1209. assem : as_alpha_as;
  1210. assemsrc : as_alpha_as;
  1211. ar : ar_alpha_ar;
  1212. res : res_none;
  1213. heapsize : 256*1024;
  1214. maxheapsize : 32768*1024;
  1215. stacksize : 8192
  1216. )
  1217. {$endif}
  1218. );
  1219. {****************************************************************************
  1220. AsmModeInfo
  1221. ****************************************************************************}
  1222. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  1223. (
  1224. id : asmmode_none;
  1225. idtxt : 'none'
  1226. )
  1227. {$ifdef i386}
  1228. ,(
  1229. id : asmmode_i386_direct;
  1230. idtxt : 'DIRECT'
  1231. ),
  1232. (
  1233. id : asmmode_i386_att;
  1234. idtxt : 'ATT'
  1235. ),
  1236. (
  1237. id : asmmode_i386_intel;
  1238. idtxt : 'INTEL'
  1239. )
  1240. {$endif i386}
  1241. {$ifdef m68k}
  1242. ,(
  1243. id : asmmode_m68k_mot;
  1244. idtxt : 'MOT'
  1245. )
  1246. {$endif m68k}
  1247. {$ifdef alpha}
  1248. ,(
  1249. id : asmmode_alpha_direct;
  1250. idtxt : 'DIRECT'
  1251. )
  1252. {$endif}
  1253. );
  1254. {****************************************************************************
  1255. Helpers
  1256. ****************************************************************************}
  1257. function upper(const s : string) : string;
  1258. var
  1259. i : longint;
  1260. begin
  1261. for i:=1 to length(s) do
  1262. if s[i] in ['a'..'z'] then
  1263. upper[i]:=char(byte(s[i])-32)
  1264. else
  1265. upper[i]:=s[i];
  1266. {$ifndef TP}
  1267. {$ifopt H+}
  1268. SetLength(upper,length(s));
  1269. {$else}
  1270. upper[0]:=s[0];
  1271. {$endif}
  1272. {$else}
  1273. upper[0]:=s[0];
  1274. {$endif}
  1275. end;
  1276. function lower(const s : string) : string;
  1277. var
  1278. i : longint;
  1279. begin
  1280. for i:=1 to length(s) do
  1281. if s[i] in ['A'..'Z'] then
  1282. lower[i]:=char(byte(s[i])+32)
  1283. else
  1284. lower[i]:=s[i];
  1285. {$ifndef TP}
  1286. {$ifopt H+}
  1287. setlength(lower,length(s));
  1288. {$else}
  1289. lower[0]:=s[0];
  1290. {$endif}
  1291. {$else}
  1292. lower[0]:=s[0];
  1293. {$endif}
  1294. end;
  1295. function set_target_os(t:tos):boolean;
  1296. var
  1297. i : longint;
  1298. begin
  1299. set_target_os:=false;
  1300. { target 1 is none }
  1301. for i:=2 to oscnt do
  1302. if os_infos[i].id=t then
  1303. begin
  1304. target_os:=os_infos[i];
  1305. set_target_os:=true;
  1306. exit;
  1307. end;
  1308. end;
  1309. function set_target_asm(t:tasm):boolean;
  1310. var
  1311. i : longint;
  1312. begin
  1313. set_target_asm:=false;
  1314. for i:=1 to asmcnt do
  1315. if as_infos[i].id=t then
  1316. begin
  1317. target_asm:=as_infos[i];
  1318. set_target_asm:=true;
  1319. exit;
  1320. end;
  1321. end;
  1322. function set_target_link(t:tlink):boolean;
  1323. var
  1324. i : longint;
  1325. begin
  1326. set_target_link:=false;
  1327. for i:=1 to linkcnt do
  1328. if link_infos[i].id=t then
  1329. begin
  1330. target_link:=link_infos[i];
  1331. set_target_link:=true;
  1332. exit;
  1333. end;
  1334. end;
  1335. function set_target_ar(t:tar):boolean;
  1336. var
  1337. i : longint;
  1338. begin
  1339. set_target_ar:=false;
  1340. for i:=1 to arcnt do
  1341. if ar_infos[i].id=t then
  1342. begin
  1343. target_ar:=ar_infos[i];
  1344. set_target_ar:=true;
  1345. exit;
  1346. end;
  1347. end;
  1348. function set_target_res(t:tres):boolean;
  1349. var
  1350. i : longint;
  1351. begin
  1352. set_target_res:=false;
  1353. for i:=1 to rescnt do
  1354. if res_infos[i].id=t then
  1355. begin
  1356. target_res:=res_infos[i];
  1357. set_target_res:=true;
  1358. exit;
  1359. end;
  1360. end;
  1361. function set_target_info(t:ttarget):boolean;
  1362. var
  1363. i : longint;
  1364. begin
  1365. set_target_info:=false;
  1366. for i:=1 to targetcnt do
  1367. if target_infos[i].target=t then
  1368. begin
  1369. target_info:=target_infos[i];
  1370. set_target_os(target_info.os);
  1371. set_target_asm(target_info.assem);
  1372. set_target_link(target_info.link);
  1373. set_target_ar(target_info.ar);
  1374. set_target_res(target_info.res);
  1375. target_path:=lower(target_info.short_name);
  1376. target_cpu:=target_info.cpu;
  1377. set_target_info:=true;
  1378. exit;
  1379. end;
  1380. end;
  1381. {****************************************************************************
  1382. Load from string
  1383. ****************************************************************************}
  1384. function set_string_target(s : string) : boolean;
  1385. var
  1386. i : longint;
  1387. begin
  1388. set_string_target:=false;
  1389. { this should be case insensitive !! PM }
  1390. s:=upper(s);
  1391. for i:=1 to targetcnt do
  1392. if target_infos[i].short_name=s then
  1393. begin
  1394. set_target_info(target_infos[i].target);
  1395. set_string_target:=true;
  1396. exit;
  1397. end;
  1398. end;
  1399. function set_string_asm(s : string) : boolean;
  1400. var
  1401. i : longint;
  1402. begin
  1403. set_string_asm:=false;
  1404. { this should be case insensitive !! PM }
  1405. s:=upper(s);
  1406. for i:=1 to asmcnt do
  1407. if as_infos[i].idtxt=s then
  1408. begin
  1409. target_asm:=as_infos[i];
  1410. set_string_asm:=true;
  1411. end;
  1412. end;
  1413. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  1414. var
  1415. i : longint;
  1416. begin
  1417. set_string_asmmode:=false;
  1418. { this should be case insensitive !! PM }
  1419. s:=upper(s);
  1420. for i:=1 to asmmodecnt do
  1421. if asmmodeinfos[i].idtxt=s then
  1422. begin
  1423. t:=asmmodeinfos[i].id;
  1424. set_string_asmmode:=true;
  1425. end;
  1426. end;
  1427. {****************************************************************************
  1428. Initialization of default target
  1429. ****************************************************************************}
  1430. procedure default_os(t:ttarget);
  1431. begin
  1432. set_target_info(t);
  1433. if source_os.name='' then
  1434. source_os:=target_os;
  1435. end;
  1436. procedure set_source_os(t:tos);
  1437. var
  1438. i : longint;
  1439. begin
  1440. { can't use message() here (PFV) }
  1441. if source_os.name<>'' then
  1442. Writeln('Warning: Source OS Redefined!');
  1443. for i:=1 to oscnt do
  1444. if os_infos[i].id=t then
  1445. begin
  1446. source_os:=os_infos[i];
  1447. exit;
  1448. end;
  1449. end;
  1450. procedure InitSystems;
  1451. begin
  1452. { first get source OS }
  1453. source_os.name:='';
  1454. { please note then we use cpu86 and cpu68 here on purpose !! }
  1455. {$ifdef cpu86}
  1456. {$ifdef GO32V1}
  1457. set_source_os(os_i386_GO32V1);
  1458. {$else}
  1459. {$ifdef GO32V2}
  1460. set_source_os(os_i386_GO32V2);
  1461. {$else}
  1462. {$ifdef OS2}
  1463. set_source_os(os_i386_OS2);
  1464. if (OS_Mode = osDOS) or (OS_Mode = osDPMI)
  1465. then source_os.scriptext := '.bat';
  1466. {OS/2 via EMX can be run under DOS as well}
  1467. {$else}
  1468. {$ifdef LINUX}
  1469. set_source_os(os_i386_LINUX);
  1470. {$else}
  1471. {$ifdef WIN32}
  1472. set_source_os(os_i386_WIN32);
  1473. {$endif win32}
  1474. {$endif linux}
  1475. {$endif os2}
  1476. {$endif go32v2}
  1477. {$endif go32v1}
  1478. {$endif cpu86}
  1479. {$ifdef cpu68}
  1480. {$ifdef AMIGA}
  1481. set_source_os(os_m68k_Amiga);
  1482. {$else}
  1483. {$ifdef ATARI}
  1484. set_source_os(os_m68k_Atari);
  1485. {$else}
  1486. {$ifdef MACOS}
  1487. set_source_os(os_m68k_MAC);
  1488. {$else}
  1489. {$ifdef LINUX}
  1490. set_source_os(os_m68k_linux);
  1491. {$endif linux}
  1492. {$endif macos}
  1493. {$endif atari}
  1494. {$endif amiga}
  1495. {$endif cpu68}
  1496. { Now default target !! }
  1497. {$ifdef i386}
  1498. {$ifdef GO32V1}
  1499. default_os(target_i386_GO32V1);
  1500. {$else}
  1501. {$ifdef GO32V2}
  1502. default_os(target_i386_GO32V2);
  1503. {$else}
  1504. {$ifdef OS2}
  1505. default_os(target_i386_OS2);
  1506. {$else}
  1507. {$ifdef LINUX}
  1508. default_os(target_i386_LINUX);
  1509. {$else}
  1510. {$ifdef WIN32}
  1511. default_os(target_i386_WIN32);
  1512. {$else}
  1513. default_os(target_i386_GO32V2);
  1514. {$endif win32}
  1515. {$endif linux}
  1516. {$endif os2}
  1517. {$endif go32v2}
  1518. {$endif go32v1}
  1519. {$endif i386}
  1520. {$ifdef m68k}
  1521. {$ifdef AMIGA}
  1522. default_os(target_m68k_Amiga);
  1523. {$else}
  1524. {$ifdef ATARI}
  1525. default_os(target_m68k_Atari);
  1526. {$else}
  1527. {$ifdef MACOS}
  1528. default_os(target_m68k_Mac);
  1529. {$else}
  1530. {$ifdef LINUX}
  1531. default_os(target_m68k_linux);
  1532. {$else}
  1533. default_os(target_m68k_Amiga);
  1534. {$endif linux}
  1535. {$endif macos}
  1536. {$endif atari}
  1537. {$endif amiga}
  1538. {$endif m68k}
  1539. end;
  1540. begin
  1541. InitSystems;
  1542. end.
  1543. {
  1544. $Log$
  1545. Revision 1.84 1999-08-02 23:56:51 michael
  1546. + Added alpha cpu and linux for alpha os
  1547. Revision 1.83 1999/07/10 10:26:20 peter
  1548. * merged
  1549. Revision 1.82.2.2 1999/07/10 10:03:16 peter
  1550. * fixed initialization/finalization in fpc mode
  1551. * allow $TARGET also in search paths
  1552. Revision 1.82.2.1 1999/07/02 12:52:58 pierre
  1553. * pecoff still buggy, as_I386_asw again default
  1554. Revision 1.82 1999/06/08 11:50:28 peter
  1555. * 2mb again for go32v2/v1
  1556. Revision 1.81 1999/06/02 20:46:39 peter
  1557. * fixed os2 bindcmd which was double
  1558. Revision 1.80 1999/06/02 14:20:31 hajny
  1559. * fixed my mistake from previously commited version
  1560. Revision 1.79 1999/06/02 13:25:34 hajny
  1561. * fixed stripping symbols for OS/2
  1562. Revision 1.78 1999/05/31 20:34:00 peter
  1563. * changed heapsize to 256k
  1564. Revision 1.77 1999/05/27 19:45:10 peter
  1565. * removed oldasm
  1566. * plabel -> pasmlabel
  1567. * -a switches to source writing automaticly
  1568. * assembler readers OOPed
  1569. * asmsymbol automaticly external
  1570. * jumptables and other label fixes for asm readers
  1571. Revision 1.76 1999/05/18 09:30:10 michael
  1572. + changes by thomas hajt
  1573. Revision 1.74 1999/05/17 13:02:12 pierre
  1574. * -Csmmm works for win32 but default is set to 32Mb
  1575. Revision 1.73 1999/05/11 00:44:06 peter
  1576. * released pecoff for win32 as default
  1577. Revision 1.72 1999/05/05 22:22:05 peter
  1578. * updated messages
  1579. Revision 1.71 1999/05/05 17:34:33 peter
  1580. * output is more like as 2.9.1
  1581. * stabs really working for go32v2
  1582. Revision 1.70 1999/05/05 09:19:18 florian
  1583. * more fixes to get it with delphi running
  1584. Revision 1.69 1999/05/03 18:03:29 peter
  1585. * no ar.exe running field in target_asm
  1586. Revision 1.68 1999/05/02 22:41:59 peter
  1587. * moved section names to systems
  1588. * fixed nasm,intel writer
  1589. Revision 1.67 1999/05/01 14:18:12 peter
  1590. * win32 pecoff disabled because it's still not ok
  1591. Revision 1.66 1999/05/01 13:24:44 peter
  1592. * merged nasm compiler
  1593. * old asm moved to oldasm/
  1594. Revision 1.65 1999/03/26 00:05:47 peter
  1595. * released valintern
  1596. + deffile is now removed when compiling is finished
  1597. * ^( compiles now correct
  1598. + static directive
  1599. * shrd fixed
  1600. Revision 1.64 1999/03/24 23:17:33 peter
  1601. * fixed bugs 212,222,225,227,229,231,233
  1602. Revision 1.63 1999/03/09 11:54:09 pierre
  1603. * pecoff default assem for win32 with ag386bin
  1604. Revision 1.62 1999/03/04 13:55:48 pierre
  1605. * some m68k fixes (still not compilable !)
  1606. * new(tobj) does not give warning if tobj has no VMT !
  1607. Revision 1.61 1999/03/03 11:41:51 pierre
  1608. + stabs info corrected to give results near to GAS output
  1609. * local labels (with .L are not stored in object anymore)
  1610. so we get the same number of symbols as from GAS !
  1611. Revision 1.60 1999/02/26 00:48:25 peter
  1612. * assembler writers fixed for ag386bin
  1613. Revision 1.59 1999/02/25 21:02:53 peter
  1614. * ag386bin updates
  1615. + coff writer
  1616. Revision 1.58 1999/02/24 00:59:16 peter
  1617. * small updates for ag386bin
  1618. Revision 1.57 1999/02/22 02:15:42 peter
  1619. * updates for ag386bin
  1620. Revision 1.56 1999/01/10 15:38:01 peter
  1621. * moved some tables from ra386*.pas -> i386.pas
  1622. + start of coff writer
  1623. * renamed asmutils unit to rautils
  1624. Revision 1.55 1999/01/06 22:58:47 florian
  1625. + some stuff for the new code generator
  1626. Revision 1.54 1998/12/28 23:26:26 peter
  1627. + resource file handling ($R directive) for Win32
  1628. Revision 1.53 1998/12/15 10:23:30 peter
  1629. + -iSO, -iSP, -iTO, -iTP
  1630. Revision 1.52 1998/12/03 10:17:32 peter
  1631. * target_os.use_bound_instruction boolean
  1632. Revision 1.51 1998/11/30 09:43:23 pierre
  1633. * some range check bugs fixed (still not working !)
  1634. + added DLL writing support for win32 (also accepts variables)
  1635. + TempAnsi for code that could be used for Temporary ansi strings
  1636. handling
  1637. Revision 1.50 1998/11/16 15:41:45 peter
  1638. * tp7 didn't like my ifopt H+ :(
  1639. Revision 1.49 1998/11/16 10:17:09 peter
  1640. * fixed for H+ compilation
  1641. Revision 1.48 1998/10/26 14:19:30 pierre
  1642. + added options -lS and -lT for source and target os output
  1643. (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
  1644. * several problems with rtti data
  1645. (type of sym was not checked)
  1646. assumed to be varsym when they could be procsym or property syms !!
  1647. Revision 1.47 1998/10/20 08:07:04 pierre
  1648. * several memory corruptions due to double freemem solved
  1649. => never use p^.loc.location:=p^.left^.loc.location;
  1650. + finally I added now by default
  1651. that ra386dir translates global and unit symbols
  1652. + added a first field in tsymtable and
  1653. a nextsym field in tsym
  1654. (this allows to obtain ordered type info for
  1655. records and objects in gdb !)
  1656. Revision 1.46 1998/10/16 08:51:54 peter
  1657. + target_os.stackalignment
  1658. + stack can be aligned at 2 or 4 byte boundaries
  1659. Revision 1.45 1998/10/15 16:20:41 peter
  1660. * removed uses verbose which is not possible! this unit may not use
  1661. any other unit !
  1662. Revision 1.44 1998/10/14 11:28:25 florian
  1663. * emitpushreferenceaddress gets now the asmlist as parameter
  1664. * m68k version compiles with -duseansistrings
  1665. Revision 1.43 1998/10/14 08:08:56 pierre
  1666. * following Peters remark, removed all ifdef in
  1667. the systems unit enums
  1668. * last bugs of cg68k removed for sysamiga
  1669. (sysamiga assembles with as68k !!)
  1670. Revision 1.42 1998/10/13 16:50:23 pierre
  1671. * undid some changes of Peter that made the compiler wrong
  1672. for m68k (I had to reinsert some ifdefs)
  1673. * removed several memory leaks under m68k
  1674. * removed the meory leaks for assembler readers
  1675. * cross compiling shoud work again better
  1676. ( crosscompiling sysamiga works
  1677. but as68k still complain about some code !)
  1678. Revision 1.41 1998/10/13 13:10:31 peter
  1679. * new style for m68k/i386 infos and enums
  1680. Revision 1.40 1998/10/13 09:13:09 pierre
  1681. * assembler type output command line was case sensitive
  1682. Revision 1.39 1998/10/13 08:19:42 pierre
  1683. + source_os is now set correctly for cross-processor compilers
  1684. (tos contains all target_infos and
  1685. we use CPU86 and CPU68 conditionnals to
  1686. get the source operating system
  1687. this only works if you do not undefine
  1688. the source target !!)
  1689. * several cg68k memory leaks fixed
  1690. + started to change the code so that it should be possible to have
  1691. a complete compiler (both for m68k and i386 !!)
  1692. Revision 1.38 1998/10/07 04:26:58 carl
  1693. * bugfixes
  1694. + added mpw support
  1695. Revision 1.37 1998/10/06 20:40:58 peter
  1696. * remove -D from assemblers
  1697. Revision 1.36 1998/09/16 16:41:50 peter
  1698. * merged fixes
  1699. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1700. * win32 .o -> .ow and .a -> .aw
  1701. Revision 1.35 1998/09/11 17:35:33 peter
  1702. * fixed tabs
  1703. Revision 1.34 1998/09/11 12:27:55 pierre
  1704. * restored m68k part
  1705. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1706. * fixed tabs
  1707. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1708. * m68k part restored
  1709. Revision 1.33 1998/09/10 15:25:39 daniel
  1710. + Added maxheapsize.
  1711. * Corrected semi-bug in calling the assembler and the linker
  1712. Revision 1.31 1998/09/01 09:07:13 peter
  1713. * m68k fixes, splitted cg68k like cgi386
  1714. Revision 1.30 1998/08/31 12:26:34 peter
  1715. * m68k and palmos updates from surebugfixes
  1716. Revision 1.29 1998/08/26 10:09:21 peter
  1717. * more lowercase extensions
  1718. Revision 1.28 1998/08/25 12:42:47 pierre
  1719. * CDECL changed to CVAR for variables
  1720. specifications are read in structures also
  1721. + started adding GPC compatibility mode ( option -Sp)
  1722. * names changed to lowercase
  1723. Revision 1.27 1998/08/21 15:16:57 peter
  1724. * win32 compiles a bit better, no growheap crash
  1725. Revision 1.26 1998/08/19 16:07:55 jonas
  1726. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1727. Revision 1.25 1998/08/18 09:24:45 pierre
  1728. * small warning position bug fixed
  1729. * support_mmx switches splitting was missing
  1730. * rhide error and warning output corrected
  1731. Revision 1.24 1998/08/17 09:17:54 peter
  1732. * static/shared linking updates
  1733. Revision 1.23 1998/06/25 08:48:20 florian
  1734. * first version of rtti support
  1735. Revision 1.22 1998/06/17 14:10:21 peter
  1736. * small os2 fixes
  1737. * fixed interdependent units with newppu (remake3 under linux works now)
  1738. Revision 1.20 1998/06/15 15:38:14 pierre
  1739. * small bug in systems.pas corrected
  1740. + operators in different units better hanlded
  1741. Revision 1.19 1998/06/15 13:34:24 daniel
  1742. * Fixed spelling mistakes in comments.
  1743. * Fixed some OS/2 parameters.
  1744. Revision 1.18 1998/06/08 22:59:54 peter
  1745. * smartlinking works for win32
  1746. * some defines to exclude some compiler parts
  1747. Revision 1.17 1998/06/04 23:52:04 peter
  1748. * m68k compiles
  1749. + .def file creation moved to gendef.pas so it could also be used
  1750. for win32
  1751. Revision 1.16 1998/06/01 16:50:22 peter
  1752. + boolean -> ord conversion
  1753. * fixed ord -> boolean conversion
  1754. Revision 1.15 1998/05/30 14:31:11 peter
  1755. + $ASMMODE
  1756. Revision 1.14 1998/05/29 13:24:45 peter
  1757. + asw assembler
  1758. Revision 1.13 1998/05/27 00:20:33 peter
  1759. * some scanner optimizes
  1760. * automaticly aout2exe for go32v1
  1761. * fixed dynamiclinker option which was added at the wrong place
  1762. Revision 1.12 1998/05/23 01:21:32 peter
  1763. + aktasmmode, aktoptprocessor, aktoutputformat
  1764. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1765. + $LIBNAME to set the library name where the unit will be put in
  1766. * splitted cgi386 a bit (codeseg to large for bp7)
  1767. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1768. Revision 1.11 1998/05/22 12:32:49 peter
  1769. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1770. Revision 1.10 1998/05/11 13:07:58 peter
  1771. + $ifdef NEWPPU for the new ppuformat
  1772. + $define GDB not longer required
  1773. * removed all warnings and stripped some log comments
  1774. * no findfirst/findnext anymore to remove smartlink *.o files
  1775. Revision 1.9 1998/05/06 08:38:49 pierre
  1776. * better position info with UseTokenInfo
  1777. UseTokenInfo greatly simplified
  1778. + added check for changed tree after first time firstpass
  1779. (if we could remove all the cases were it happen
  1780. we could skip all firstpass if firstpasscount > 1)
  1781. Only with ExtDebug
  1782. Revision 1.8 1998/05/04 20:19:54 peter
  1783. * small fix for go32v2
  1784. Revision 1.7 1998/05/04 17:54:29 peter
  1785. + smartlinking works (only case jumptable left todo)
  1786. * redesign of systems.pas to support assemblers and linkers
  1787. + Unitname is now also in the PPU-file, increased version to 14
  1788. Revision 1.6 1998/05/01 07:43:57 florian
  1789. + basics for rtti implemented
  1790. + switch $m (generate rtti for published sections)
  1791. Revision 1.5 1998/04/29 10:34:06 pierre
  1792. + added some code for ansistring (not complete nor working yet)
  1793. * corrected operator overloading
  1794. * corrected nasm output
  1795. + started inline procedures
  1796. + added starstarn : use ** for exponentiation (^ gave problems)
  1797. + started UseTokenInfo cond to get accurate positions
  1798. Revision 1.4 1998/04/27 15:45:20 peter
  1799. + -Xl for smartlink
  1800. + target_info.arext = .a
  1801. Revision 1.3 1998/04/16 10:50:45 daniel
  1802. * Fixed some things that were broken for OS/2.
  1803. }