systems.pas 57 KB

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