systems.pas 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318
  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. type
  31. tasmmode= (asmmode_none
  32. ,asmmode_i386_direct,asmmode_i386_att,asmmode_i386_intel
  33. ,asmmode_m68k_mot
  34. );
  35. const
  36. {$ifdef i386} i386asmmodecnt=3; {$else} i386asmmodecnt=0; {$endif}
  37. {$ifdef m68k} m68kasmmodecnt=1; {$else} m68kasmmodecnt=0; {$endif}
  38. asmmodecnt=i386asmmodecnt+m68kasmmodecnt+1;
  39. type
  40. ttarget = (target_none
  41. ,target_i386_GO32V1,target_i386_GO32V2,target_i386_linux,
  42. target_i386_OS2,target_i386_Win32
  43. ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac,
  44. target_m68k_linux,target_m68k_PalmOS
  45. );
  46. const
  47. {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif}
  48. {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif}
  49. targetcnt=i386targetcnt+m68ktargetcnt+1;
  50. type
  51. tasm = (as_none
  52. ,as_i386_o,as_i386_o_aout,as_i386_asw,
  53. as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
  54. as_i386_tasm,as_i386_masm
  55. ,as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
  56. );
  57. const
  58. {$ifdef i386} i386asmcnt=8; {$else} i386asmcnt=0; {$endif}
  59. {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif}
  60. asmcnt=i386asmcnt+m68kasmcnt+1;
  61. type
  62. tlink = (link_none
  63. ,link_i386_ld,link_i386_ldgo32v1,
  64. link_i386_ldgo32v2,link_i386_ldw,
  65. link_i386_ldos2
  66. ,link_m68k_ld
  67. );
  68. const
  69. {$ifdef i386} i386linkcnt=5; {$else} i386linkcnt=0; {$endif}
  70. {$ifdef m68k} m68klinkcnt=1; {$else} m68klinkcnt=0; {$endif}
  71. linkcnt=i386linkcnt+m68klinkcnt+1;
  72. type
  73. tar = (ar_none
  74. ,ar_i386_ar,ar_i386_arw
  75. ,ar_m68k_ar
  76. );
  77. const
  78. {$ifdef i386} i386arcnt=2; {$else} i386arcnt=0; {$endif}
  79. {$ifdef m68k} m68karcnt=1; {$else} m68karcnt=0; {$endif}
  80. arcnt=i386arcnt+m68karcnt+1;
  81. type
  82. tos = ( os_none,
  83. os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2,
  84. os_i386_Win32,
  85. os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux,
  86. os_m68k_PalmOS
  87. );
  88. const
  89. i386oscnt=5;
  90. m68koscnt=5;
  91. oscnt=i386oscnt+m68koscnt+1;
  92. type
  93. tosinfo = packed record
  94. id : tos;
  95. name : string[30];
  96. sharedlibext,
  97. staticlibext,
  98. sourceext,
  99. pasext,
  100. exeext,
  101. scriptext : string[4];
  102. libprefix : string[3];
  103. Cprefix : string[2];
  104. newline : string[2];
  105. endian : tendian;
  106. use_function_relative_addresses : boolean;
  107. end;
  108. tasminfo = packed record
  109. id : tasm;
  110. idtxt : string[8];
  111. asmbin : string[8];
  112. asmcmd : string[50];
  113. externals : boolean;
  114. labelprefix : string[2];
  115. comment : string[2];
  116. end;
  117. tlinkinfo = packed record
  118. id : tlink;
  119. linkbin : string[8];
  120. linkcmd : string[50];
  121. bindbin : string[8];
  122. bindcmd : string[50];
  123. stripopt : string[2];
  124. libpathprefix : string[13];
  125. libpathsuffix : string[2];
  126. groupstart : string[8];
  127. groupend : string[2];
  128. inputstart : string[8];
  129. inputend : string[2];
  130. libprefix : string[2];
  131. end;
  132. tarinfo = packed record
  133. id : tar;
  134. arbin : string[8];
  135. arcmd : string[50];
  136. end;
  137. ttargetinfo = packed record
  138. target : ttarget;
  139. cpu : ttargetcpu;
  140. short_name : string[8];
  141. unit_env : string[12];
  142. system_unit : string[8];
  143. smartext,
  144. unitext,
  145. unitlibext,
  146. asmext,
  147. objext,
  148. exeext : string[4];
  149. os : tos;
  150. link : tlink;
  151. assem : tasm;
  152. ar : tar;
  153. heapsize,
  154. maxheapsize,
  155. stacksize : longint;
  156. end;
  157. tasmmodeinfo=packed record
  158. id : tasmmode;
  159. idtxt : string[8];
  160. end;
  161. var
  162. target_cpu : ttargetcpu;
  163. target_info : ttargetinfo;
  164. target_os : tosinfo;
  165. target_asm : tasminfo;
  166. target_link : tlinkinfo;
  167. target_ar : tarinfo;
  168. source_os : tosinfo;
  169. function set_string_target(s : string) : boolean;
  170. function set_string_asm(s : string) : boolean;
  171. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  172. implementation
  173. uses
  174. globals,verbose;
  175. const
  176. {****************************************************************************
  177. OS Info
  178. ****************************************************************************}
  179. os_infos : array[1..oscnt] of tosinfo = (
  180. (
  181. id : os_none;
  182. name : 'No operating system'
  183. ),
  184. (
  185. id : os_i386_go32v1;
  186. name : 'GO32 V1 DOS extender';
  187. sharedlibext : '.dll';
  188. staticlibext : '.a';
  189. sourceext : '.pp';
  190. pasext : '.pas';
  191. exeext : ''; { No .exe, the linker only output a.out ! }
  192. scriptext : '.bat';
  193. libprefix : '';
  194. Cprefix : '_';
  195. newline : #13#10;
  196. endian : endian_little;
  197. use_function_relative_addresses : true
  198. ),
  199. (
  200. id : os_i386_go32v2;
  201. name : 'GO32 V2 DOS extender';
  202. sharedlibext : '.dll';
  203. staticlibext : '.a';
  204. sourceext : '.pp';
  205. pasext : '.pas';
  206. exeext : '.exe';
  207. scriptext : '.bat';
  208. libprefix : '';
  209. Cprefix : '_';
  210. newline : #13#10;
  211. endian : endian_little;
  212. use_function_relative_addresses : true
  213. ),
  214. (
  215. id : os_i386_linux;
  216. name : 'Linux-i386';
  217. sharedlibext : '.so';
  218. staticlibext : '.a';
  219. sourceext : '.pp';
  220. pasext : '.pas';
  221. exeext : '';
  222. scriptext : '.sh';
  223. libprefix : 'lib';
  224. Cprefix : '';
  225. newline : #10;
  226. endian : endian_little;
  227. use_function_relative_addresses : true
  228. ),
  229. (
  230. id : os_i386_os2;
  231. name : 'OS/2 via EMX';
  232. sharedlibext : '.ao2';
  233. staticlibext : '.ao2';
  234. sourceext : '.pas';
  235. pasext : '.pp';
  236. exeext : '.exe';
  237. scriptext : '.cmd';
  238. libprefix : '';
  239. Cprefix : '_';
  240. newline : #13#10;
  241. endian : endian_little;
  242. use_function_relative_addresses : false
  243. ),
  244. (
  245. id : os_i386_win32;
  246. name : 'Win32';
  247. sharedlibext : '.dll';
  248. staticlibext : '.aw';
  249. sourceext : '.pp';
  250. pasext : '.pas';
  251. exeext : '.exe';
  252. scriptext : '.bat';
  253. libprefix : 'lib';
  254. Cprefix : '_';
  255. newline : #13#10;
  256. endian : endian_little;
  257. use_function_relative_addresses : true
  258. ),
  259. (
  260. id : os_m68k_amiga;
  261. name : 'Commodore Amiga';
  262. sharedlibext : '.library';
  263. staticlibext : '.a';
  264. sourceext : '.pp';
  265. pasext : '.pas';
  266. exeext : '';
  267. scriptext : '';
  268. libprefix : '';
  269. Cprefix : '_';
  270. newline : #10;
  271. endian : endian_big;
  272. use_function_relative_addresses : false
  273. ),
  274. (
  275. id : os_m68k_atari;
  276. name : 'Atari ST/STE';
  277. sharedlibext : '.dll';
  278. staticlibext : '.a';
  279. sourceext : '.pp';
  280. pasext : '.pas';
  281. exeext : '.tpp';
  282. scriptext : '';
  283. libprefix : '';
  284. Cprefix : '_';
  285. newline : #10;
  286. endian : endian_big;
  287. use_function_relative_addresses : false
  288. ),
  289. (
  290. id : os_m68k_mac;
  291. name : 'Macintosh m68k';
  292. sharedlibext : '.dll';
  293. staticlibext : '.a';
  294. sourceext : '.pp';
  295. pasext : '.pas';
  296. exeext : '.tpp';
  297. scriptext : '';
  298. libprefix : '';
  299. Cprefix : '_';
  300. newline : #13;
  301. endian : endian_big;
  302. use_function_relative_addresses : false
  303. ),
  304. (
  305. id : os_m68k_linux;
  306. name : 'Linux-m68k';
  307. sharedlibext : '.so';
  308. staticlibext : '.a';
  309. sourceext : '.pp';
  310. pasext : '.pas';
  311. exeext : '';
  312. scriptext : '.sh';
  313. libprefix : 'lib';
  314. Cprefix : '';
  315. newline : #10;
  316. endian : endian_big;
  317. use_function_relative_addresses : true
  318. ),
  319. (
  320. id : os_m68k_palmos;
  321. name : 'PalmOS';
  322. sharedlibext : '.so';
  323. staticlibext : '.a';
  324. sourceext : '.pp';
  325. pasext : '.pas';
  326. exeext : '';
  327. scriptext : '.sh';
  328. libprefix : 'lib';
  329. Cprefix : '_';
  330. newline : #10;
  331. endian : endian_big;
  332. use_function_relative_addresses : false
  333. )
  334. );
  335. {****************************************************************************
  336. Assembler Info
  337. ****************************************************************************}
  338. as_infos : array[1..asmcnt] of tasminfo = (
  339. (
  340. id : as_none;
  341. idtxt : 'no'
  342. )
  343. {$ifdef i386}
  344. ,(
  345. id : as_i386_o;
  346. idtxt : 'O';
  347. asmbin : 'as';
  348. asmcmd : '-o $OBJ $ASM';
  349. externals : false;
  350. labelprefix : '.L';
  351. comment : '# '
  352. )
  353. ,(
  354. id : as_i386_o_aout;
  355. idtxt : 'O_AOUT';
  356. asmbin : 'as';
  357. asmcmd : '-o $OBJ $ASM';
  358. externals : false;
  359. labelprefix : 'L';
  360. comment : '# '
  361. )
  362. ,(
  363. id : as_i386_asw;
  364. idtxt : 'ASW';
  365. asmbin : 'asw';
  366. asmcmd : '-o $OBJ $ASM';
  367. externals : false;
  368. labelprefix : '.L';
  369. comment : '# '
  370. )
  371. ,(
  372. id : as_i386_nasmcoff;
  373. idtxt : 'NASMCOFF';
  374. asmbin : 'nasm';
  375. asmcmd : '-f coff -o $OBJ $ASM';
  376. externals : true;
  377. labelprefix : 'L';
  378. comment : '; '
  379. )
  380. ,(
  381. id : as_i386_nasmelf;
  382. idtxt : 'NASMELF';
  383. asmbin : 'nasm';
  384. asmcmd : '-f elf -o $OBJ $ASM';
  385. externals : true;
  386. labelprefix : 'L';
  387. comment : '; '
  388. )
  389. ,(
  390. id : as_i386_nasmobj;
  391. idtxt : 'NASMOBJ';
  392. asmbin : 'nasm';
  393. asmcmd : '-f obj -o $OBJ $ASM';
  394. externals : true;
  395. labelprefix : 'L';
  396. comment : '; '
  397. )
  398. ,(
  399. id : as_i386_tasm;
  400. idtxt : 'TASM';
  401. asmbin : 'tasm';
  402. asmcmd : '/m2 $ASM $OBJ';
  403. externals : true;
  404. labelprefix : '.L';
  405. comment : '; '
  406. )
  407. ,(
  408. id : as_i386_masm;
  409. idtxt : 'MASM';
  410. asmbin : 'masm';
  411. asmcmd : '$ASM $OBJ';
  412. externals : true;
  413. labelprefix : '.L';
  414. comment : '; '
  415. )
  416. {$endif i386}
  417. {$ifdef m68k}
  418. ,(
  419. id : as_m68k_o;
  420. idtxt : 'O';
  421. asmbin : 'as';
  422. asmcmd : '-o $OBJ $ASM';
  423. externals : false;
  424. labelprefix : '.L';
  425. comment : '# '
  426. )
  427. ,(
  428. id : as_m68k_gas;
  429. idtxt : 'GAS';
  430. asmbin : 'as68k'; { Gas for the Amiga}
  431. asmcmd : '--register-prefix-optional -o $OBJ $ASM';
  432. externals : false;
  433. labelprefix : '.L';
  434. comment : '| '
  435. )
  436. ,(
  437. id : as_m68k_mit;
  438. idtxt : 'MIT';
  439. asmbin : '';
  440. asmcmd : '-o $OBJ $ASM';
  441. externals : false;
  442. labelprefix : '.L';
  443. comment : '| '
  444. )
  445. ,(
  446. id : as_m68k_mot;
  447. idtxt : 'MOT';
  448. asmbin : '';
  449. asmcmd : '-o $OBJ $ASM';
  450. externals : false;
  451. labelprefix : '__L';
  452. comment : '| '
  453. )
  454. ,(
  455. id : as_m68k_mpw;
  456. idtxt : 'MPW';
  457. asmbin : '';
  458. asmcmd : '-model far -o $OBJ $ASM';
  459. externals : false;
  460. labelprefix : '__L';
  461. comment : '| '
  462. )
  463. {$endif m68k}
  464. );
  465. {****************************************************************************
  466. Linker Info
  467. ****************************************************************************}
  468. link_infos : array[1..linkcnt] of tlinkinfo = (
  469. (
  470. id : link_none
  471. )
  472. {$ifdef i386}
  473. ,(
  474. id : link_i386_ld;
  475. linkbin : 'ld';
  476. linkcmd : '$OPT -o $EXE $RES';
  477. bindbin : '';
  478. bindcmd : '';
  479. stripopt : '-s';
  480. libpathprefix : 'SEARCH_DIR(';
  481. libpathsuffix : ')';
  482. groupstart : 'GROUP(';
  483. groupend : ')';
  484. inputstart : 'INPUT(';
  485. inputend : ')';
  486. libprefix : '-l'
  487. )
  488. ,(
  489. id : link_i386_ldgo32v1;
  490. linkbin : 'ld';
  491. linkcmd : '-oformat coff-go32 $OPT -o $EXE @$RES';
  492. bindbin : 'aout2exe';
  493. bindcmd : '$EXE';
  494. stripopt : '-s';
  495. libpathprefix : '-L';
  496. libpathsuffix : '';
  497. groupstart : '-(';
  498. groupend : '-)';
  499. inputstart : '';
  500. inputend : '';
  501. libprefix : '-l'
  502. )
  503. ,(
  504. id : link_i386_ldgo32v2;
  505. linkbin : 'ld';
  506. linkcmd : '-oformat coff-go32-exe $OPT -o $EXE @$RES';
  507. bindbin : '';
  508. bindcmd : '';
  509. stripopt : '-s';
  510. libpathprefix : '-L';
  511. libpathsuffix : '';
  512. groupstart : '-(';
  513. groupend : '-)';
  514. inputstart : '';
  515. inputend : '';
  516. libprefix : '-l'
  517. )
  518. ,(
  519. id : link_i386_ldw;
  520. linkbin : 'ldw';
  521. linkcmd : '$OPT -o $EXE $RES';
  522. bindbin : '';
  523. bindcmd : '';
  524. stripopt : '-s';
  525. libpathprefix : 'SEARCH_DIR(';
  526. libpathsuffix : ')';
  527. groupstart : 'GROUP(';
  528. groupend : ')';
  529. inputstart : 'INPUT(';
  530. inputend : ')';
  531. libprefix : '-l'
  532. )
  533. ,(
  534. id : link_i386_ldos2;
  535. linkbin : 'ld'; { Os/2 }
  536. linkcmd : '-o $EXE @$RES';
  537. bindbin : 'emxbind';
  538. bindcmd : '-b -k$STACKKB -h$HEAPMB -o $EXE.exe $EXE -aim -s$DOSHEAPKB';
  539. stripopt : '-s';
  540. libpathprefix : '-L';
  541. libpathsuffix : '';
  542. groupstart : ''; {Linker is too primitive...}
  543. groupend : '';
  544. inputstart : '';
  545. inputend : '';
  546. libprefix : '-l'
  547. )
  548. {$endif i386}
  549. {$ifdef m68k}
  550. ,(
  551. id : link_m68k_ld;
  552. linkbin : 'ld';
  553. linkcmd : '$OPT -o $EXE $RES';
  554. bindbin : '';
  555. bindcmd : '';
  556. stripopt : '-s';
  557. libpathprefix : 'SEARCH_DIR(';
  558. libpathsuffix : ')';
  559. groupstart : 'GROUP(';
  560. groupend : ')';
  561. inputstart : 'INPUT(';
  562. inputend : ')';
  563. libprefix : '-l'
  564. )
  565. {$endif m68k}
  566. );
  567. {****************************************************************************
  568. Ar Info
  569. ****************************************************************************}
  570. ar_infos : array[1..arcnt] of tarinfo = (
  571. (
  572. id : ar_none
  573. )
  574. {$ifdef i386}
  575. ,(
  576. id : ar_i386_ar;
  577. arbin : 'ar';
  578. arcmd : 'rs $LIB $FILES'
  579. ),
  580. (
  581. id : ar_i386_arw;
  582. arbin : 'arw';
  583. arcmd : 'rs $LIB $FILES'
  584. )
  585. {$endif i386}
  586. {$ifdef m68k}
  587. ,(
  588. id : ar_m68k_ar;
  589. arbin : 'ar';
  590. arcmd : 'rs $LIB $FILES'
  591. )
  592. {$endif m68k}
  593. );
  594. {****************************************************************************
  595. Targets Info
  596. ****************************************************************************}
  597. target_infos : array[1..targetcnt] of ttargetinfo = (
  598. (
  599. target : target_none;
  600. cpu : no_cpu;
  601. short_name : 'notarget'
  602. )
  603. {$ifdef i386}
  604. ,(
  605. target : target_i386_GO32V1;
  606. cpu : i386;
  607. short_name : 'GO32V1';
  608. unit_env : 'GO32V1UNITS';
  609. system_unit : 'SYSTEM';
  610. smartext : '.sl';
  611. unitext : '.pp1';
  612. unitlibext : '.ppl';
  613. asmext : '.s1';
  614. objext : '.o1';
  615. exeext : ''; { The linker produces a.out }
  616. os : os_i386_GO32V1;
  617. link : link_i386_ldgo32v1;
  618. assem : as_i386_o;
  619. ar : ar_i386_ar;
  620. heapsize : 2048*1024;
  621. maxheapsize : 32768*1024;
  622. stacksize : 16384
  623. ),
  624. (
  625. target : target_i386_GO32V2;
  626. cpu : i386;
  627. short_name : 'GO32V2';
  628. unit_env : 'GO32V2UNITS';
  629. system_unit : 'SYSTEM';
  630. smartext : '.sl';
  631. unitext : '.ppu';
  632. unitlibext : '.ppl';
  633. asmext : '.s';
  634. objext : '.o';
  635. exeext : '.exe';
  636. os : os_i386_GO32V2;
  637. link : link_i386_ldgo32v2;
  638. assem : as_i386_o;
  639. ar : ar_i386_ar;
  640. heapsize : 2048*1024;
  641. maxheapsize : 32768*1024;
  642. stacksize : 16384
  643. ),
  644. (
  645. target : target_i386_LINUX;
  646. cpu : i386;
  647. short_name : 'LINUX';
  648. unit_env : 'LINUXUNITS';
  649. system_unit : 'syslinux';
  650. smartext : '.sl';
  651. unitext : '.ppu';
  652. unitlibext : '.ppl';
  653. asmext : '.s';
  654. objext : '.o';
  655. exeext : '';
  656. os : os_i386_Linux;
  657. link : link_i386_ld;
  658. assem : as_i386_o;
  659. ar : ar_i386_ar;
  660. heapsize : 2048*1024;
  661. maxheapsize : 32768*1024;
  662. stacksize : 8192
  663. ),
  664. (
  665. target : target_i386_OS2;
  666. cpu : i386;
  667. short_name : 'OS2';
  668. unit_env : 'OS2UNITS';
  669. system_unit : 'SYSOS2';
  670. smartext : '.sl';
  671. unitext : '.ppo';
  672. unitlibext : '.ppl';
  673. asmext : '.so2';
  674. objext : '.oo2';
  675. exeext : ''; { The linker produces a.out }
  676. os : os_i386_OS2;
  677. link : link_i386_ldos2;
  678. assem : as_i386_o_aout;
  679. ar : ar_i386_ar;
  680. heapsize : 256*1024;
  681. maxheapsize : 32768*1024;
  682. stacksize : 32768
  683. ),
  684. (
  685. target : target_i386_WIN32;
  686. cpu : i386;
  687. short_name : 'WIN32';
  688. unit_env : 'WIN32UNITS';
  689. system_unit : 'SYSWIN32';
  690. smartext : '.slw';
  691. unitext : '.ppw';
  692. unitlibext : '.ppl';
  693. asmext : '.sw';
  694. objext : '.ow';
  695. exeext : '.exe';
  696. os : os_i386_Win32;
  697. link : link_i386_ldw;
  698. assem : as_i386_asw;
  699. ar : ar_i386_arw;
  700. heapsize : 2048*1024;
  701. maxheapsize : 32768*1024;
  702. stacksize : 32768
  703. )
  704. {$endif i386}
  705. {$ifdef m68k}
  706. ,(
  707. target : target_m68k_Amiga;
  708. cpu : m68k;
  709. short_name : 'AMIGA';
  710. unit_env : '';
  711. system_unit : 'sysamiga';
  712. smartext : '.sl';
  713. unitext : '.ppa';
  714. unitlibext : '.ppl';
  715. asmext : '.asm';
  716. objext : '.o';
  717. exeext : '';
  718. os : os_m68k_Amiga;
  719. link : link_m68k_ld;
  720. assem : as_m68k_o;
  721. ar : ar_m68k_ar;
  722. heapsize : 128*1024;
  723. maxheapsize : 32768*1024;
  724. stacksize : 8192
  725. ),
  726. (
  727. target : target_m68k_Atari;
  728. cpu : m68k;
  729. short_name : 'ATARI';
  730. unit_env : '';
  731. system_unit : 'SYSATARI';
  732. smartext : '.sl';
  733. unitext : '.ppt';
  734. unitlibext : '.ppl';
  735. asmext : '.s';
  736. objext : '.o';
  737. exeext : '.ttp';
  738. os : os_m68k_Atari;
  739. link : link_m68k_ld;
  740. assem : as_m68k_o;
  741. ar : ar_m68k_ar;
  742. heapsize : 16*1024;
  743. maxheapsize : 32768*1024;
  744. stacksize : 8192
  745. ),
  746. (
  747. target : target_m68k_Mac;
  748. cpu : m68k;
  749. short_name : 'MACOS';
  750. unit_env : '';
  751. system_unit : 'sysmac';
  752. smartext : '.sl';
  753. unitext : '.ppt';
  754. unitlibext : '.ppl';
  755. asmext : '.a';
  756. objext : '.o';
  757. exeext : '';
  758. os : os_m68k_Mac;
  759. link : link_m68k_ld;
  760. assem : as_m68k_mpw;
  761. ar : ar_m68k_ar;
  762. heapsize : 128*1024;
  763. maxheapsize : 32768*1024;
  764. stacksize : 8192
  765. ),
  766. (
  767. target : target_m68k_linux;
  768. cpu : m68k;
  769. short_name : 'LINUX';
  770. unit_env : 'LINUXUNITS';
  771. system_unit : 'syslinux';
  772. smartext : '.sl';
  773. unitext : '.ppu';
  774. unitlibext : '.ppl';
  775. asmext : '.s';
  776. objext : '.o';
  777. exeext : '';
  778. os : os_m68k_Linux;
  779. link : link_m68k_ld;
  780. assem : as_m68k_o;
  781. ar : ar_m68k_ar;
  782. heapsize : 128*1024;
  783. maxheapsize : 32768*1024;
  784. stacksize : 8192
  785. ),
  786. (
  787. target : target_m68k_PalmOS;
  788. cpu : m68k;
  789. short_name : 'PALMOS';
  790. unit_env : 'PALMUNITS';
  791. system_unit : 'syspalm';
  792. smartext : '.sl';
  793. unitext : '.ppu';
  794. unitlibext : '.ppl';
  795. asmext : '.s';
  796. objext : '.o';
  797. exeext : '';
  798. os : os_m68k_PalmOS;
  799. link : link_m68k_ld;
  800. assem : as_m68k_o;
  801. ar : ar_m68k_ar;
  802. heapsize : 128*1024;
  803. maxheapsize : 32768*1024;
  804. stacksize : 8192
  805. )
  806. {$endif m68k}
  807. );
  808. {****************************************************************************
  809. AsmModeInfo
  810. ****************************************************************************}
  811. asmmodeinfos : array[1..asmmodecnt] of tasmmodeinfo = (
  812. (
  813. id : asmmode_none;
  814. idtxt : 'none'
  815. )
  816. {$ifdef i386}
  817. ,(
  818. id : asmmode_i386_direct;
  819. idtxt : 'DIRECT'
  820. ),
  821. (
  822. id : asmmode_i386_att;
  823. idtxt : 'ATT'
  824. ),
  825. (
  826. id : asmmode_i386_intel;
  827. idtxt : 'INTEL'
  828. )
  829. {$endif i386}
  830. {$ifdef m68k}
  831. ,(
  832. id : asmmode_m68k_mot;
  833. idtxt : 'MOT'
  834. )
  835. {$endif m68k}
  836. );
  837. {****************************************************************************
  838. Helpers
  839. ****************************************************************************}
  840. function set_target_os(t:tos):boolean;
  841. var
  842. i : longint;
  843. begin
  844. set_target_os:=false;
  845. { target 1 is none }
  846. for i:=2 to oscnt do
  847. if os_infos[i].id=t then
  848. begin
  849. target_os:=os_infos[i];
  850. set_target_os:=true;
  851. exit;
  852. end;
  853. end;
  854. function set_target_asm(t:tasm):boolean;
  855. var
  856. i : longint;
  857. begin
  858. set_target_asm:=false;
  859. for i:=1 to asmcnt do
  860. if as_infos[i].id=t then
  861. begin
  862. target_asm:=as_infos[i];
  863. set_target_asm:=true;
  864. exit;
  865. end;
  866. end;
  867. function set_target_link(t:tlink):boolean;
  868. var
  869. i : longint;
  870. begin
  871. set_target_link:=false;
  872. for i:=1 to linkcnt do
  873. if link_infos[i].id=t then
  874. begin
  875. target_link:=link_infos[i];
  876. set_target_link:=true;
  877. exit;
  878. end;
  879. end;
  880. function set_target_ar(t:tar):boolean;
  881. var
  882. i : longint;
  883. begin
  884. set_target_ar:=false;
  885. for i:=1 to arcnt do
  886. if ar_infos[i].id=t then
  887. begin
  888. target_ar:=ar_infos[i];
  889. set_target_ar:=true;
  890. exit;
  891. end;
  892. end;
  893. function set_target_info(t:ttarget):boolean;
  894. var
  895. i : longint;
  896. begin
  897. set_target_info:=false;
  898. for i:=1 to targetcnt do
  899. if target_infos[i].target=t then
  900. begin
  901. target_info:=target_infos[i];
  902. set_target_os(target_info.os);
  903. set_target_asm(target_info.assem);
  904. set_target_link(target_info.link);
  905. set_target_ar(target_info.ar);
  906. target_cpu:=target_info.cpu;
  907. set_target_info:=true;
  908. exit;
  909. end;
  910. end;
  911. {****************************************************************************
  912. Load from string
  913. ****************************************************************************}
  914. function set_string_target(s : string) : boolean;
  915. var
  916. i : longint;
  917. begin
  918. set_string_target:=false;
  919. { this should be case insensitive !! PM }
  920. s:=upper(s);
  921. for i:=1 to targetcnt do
  922. if target_infos[i].short_name=s then
  923. begin
  924. target_info:=target_infos[i];
  925. set_target_os(target_info.os);
  926. set_target_asm(target_info.assem);
  927. set_target_link(target_info.link);
  928. set_target_ar(target_info.ar);
  929. target_cpu:=target_info.cpu;
  930. set_string_target:=true;
  931. exit;
  932. end;
  933. end;
  934. function set_string_asm(s : string) : boolean;
  935. var
  936. i : longint;
  937. begin
  938. set_string_asm:=false;
  939. { this should be case insensitive !! PM }
  940. s:=upper(s);
  941. for i:=1 to asmcnt do
  942. if as_infos[i].idtxt=s then
  943. begin
  944. target_asm:=as_infos[i];
  945. set_string_asm:=true;
  946. end;
  947. end;
  948. function set_string_asmmode(s:string;var t:tasmmode):boolean;
  949. var
  950. i : longint;
  951. begin
  952. set_string_asmmode:=false;
  953. { this should be case insensitive !! PM }
  954. s:=upper(s);
  955. for i:=1 to asmmodecnt do
  956. if asmmodeinfos[i].idtxt=s then
  957. begin
  958. t:=asmmodeinfos[i].id;
  959. set_string_asmmode:=true;
  960. end;
  961. end;
  962. {****************************************************************************
  963. Initialization of default target
  964. ****************************************************************************}
  965. procedure default_os(t:ttarget);
  966. begin
  967. set_target_info(t);
  968. if source_os.name='' then
  969. source_os:=target_os;
  970. end;
  971. procedure set_source_os(t:tos);
  972. var
  973. i : longint;
  974. begin
  975. if source_os.name<>'' then
  976. Message(exec_w_source_os_redefined);
  977. for i:=1 to oscnt do
  978. if os_infos[i].id=t then
  979. begin
  980. source_os:=os_infos[i];
  981. exit;
  982. end;
  983. end;
  984. begin
  985. { first get source OS }
  986. source_os.name:='';
  987. { please note then we use cpu86 and cpu68 here on purpose !! }
  988. {$ifdef cpu86}
  989. {$ifdef GO32V1}
  990. set_source_os(os_i386_GO32V1);
  991. {$else}
  992. {$ifdef GO32V2}
  993. set_source_os(os_i386_GO32V2);
  994. {$else}
  995. {$ifdef OS2}
  996. set_source_os(os_i386_OS2);
  997. {$else}
  998. {$ifdef LINUX}
  999. set_source_os(os_i386_LINUX);
  1000. {$else}
  1001. {$ifdef WIN32}
  1002. set_source_os(os_i386_WIN32);
  1003. {$endif win32}
  1004. {$endif linux}
  1005. {$endif os2}
  1006. {$endif go32v2}
  1007. {$endif go32v1}
  1008. {$endif cpu86}
  1009. {$ifdef cpu68}
  1010. {$ifdef AMIGA}
  1011. set_source_os(os_m68k_Amiga);
  1012. {$else}
  1013. {$ifdef ATARI}
  1014. set_source_os(os_m68k_Atari);
  1015. {$else}
  1016. {$ifdef MACOS}
  1017. set_source_os(os_m68k_MAC);
  1018. {$else}
  1019. {$ifdef LINUX}
  1020. set_source_os(os_m68k_linux);
  1021. {$endif linux}
  1022. {$endif macos}
  1023. {$endif atari}
  1024. {$endif amiga}
  1025. {$endif cpu68}
  1026. { Now default target !! }
  1027. {$ifdef i386}
  1028. {$ifdef GO32V1}
  1029. default_os(target_i386_GO32V1);
  1030. {$else}
  1031. {$ifdef GO32V2}
  1032. default_os(target_i386_GO32V2);
  1033. {$else}
  1034. {$ifdef OS2}
  1035. default_os(target_i386_OS2);
  1036. {$else}
  1037. {$ifdef LINUX}
  1038. default_os(target_i386_LINUX);
  1039. {$else}
  1040. {$ifdef WIN32}
  1041. default_os(target_i386_WIN32);
  1042. {$else}
  1043. default_os(target_i386_GO32V2);
  1044. {$endif win32}
  1045. {$endif linux}
  1046. {$endif os2}
  1047. {$endif go32v2}
  1048. {$endif go32v1}
  1049. {$endif i386}
  1050. {$ifdef m68k}
  1051. {$ifdef AMIGA}
  1052. default_os(target_m68k_Amiga);
  1053. {$else}
  1054. {$ifdef ATARI}
  1055. default_os(target_m68k_Atari);
  1056. {$else}
  1057. {$ifdef MACOS}
  1058. default_os(target_m68k_Mac);
  1059. {$else}
  1060. {$ifdef LINUX}
  1061. default_os(target_m68k_linux);
  1062. {$else}
  1063. default_os(target_m68k_Amiga);
  1064. {$endif linux}
  1065. {$endif macos}
  1066. {$endif atari}
  1067. {$endif amiga}
  1068. {$endif m68k}
  1069. end.
  1070. {
  1071. $Log$
  1072. Revision 1.44 1998-10-14 11:28:25 florian
  1073. * emitpushreferenceaddress gets now the asmlist as parameter
  1074. * m68k version compiles with -duseansistrings
  1075. Revision 1.43 1998/10/14 08:08:56 pierre
  1076. * following Peters remark, removed all ifdef in
  1077. the systems unit enums
  1078. * last bugs of cg68k removed for sysamiga
  1079. (sysamiga assembles with as68k !!)
  1080. Revision 1.42 1998/10/13 16:50:23 pierre
  1081. * undid some changes of Peter that made the compiler wrong
  1082. for m68k (I had to reinsert some ifdefs)
  1083. * removed several memory leaks under m68k
  1084. * removed the meory leaks for assembler readers
  1085. * cross compiling shoud work again better
  1086. ( crosscompiling sysamiga works
  1087. but as68k still complain about some code !)
  1088. Revision 1.41 1998/10/13 13:10:31 peter
  1089. * new style for m68k/i386 infos and enums
  1090. Revision 1.40 1998/10/13 09:13:09 pierre
  1091. * assembler type output command line was case sensitive
  1092. Revision 1.39 1998/10/13 08:19:42 pierre
  1093. + source_os is now set correctly for cross-processor compilers
  1094. (tos contains all target_infos and
  1095. we use CPU86 and CPU68 conditionnals to
  1096. get the source operating system
  1097. this only works if you do not undefine
  1098. the source target !!)
  1099. * several cg68k memory leaks fixed
  1100. + started to change the code so that it should be possible to have
  1101. a complete compiler (both for m68k and i386 !!)
  1102. Revision 1.38 1998/10/07 04:26:58 carl
  1103. * bugfixes
  1104. + added mpw support
  1105. Revision 1.37 1998/10/06 20:40:58 peter
  1106. * remove -D from assemblers
  1107. Revision 1.36 1998/09/16 16:41:50 peter
  1108. * merged fixes
  1109. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1110. * win32 .o -> .ow and .a -> .aw
  1111. Revision 1.35 1998/09/11 17:35:33 peter
  1112. * fixed tabs
  1113. Revision 1.34 1998/09/11 12:27:55 pierre
  1114. * restored m68k part
  1115. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1116. * fixed tabs
  1117. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1118. * m68k part restored
  1119. Revision 1.33 1998/09/10 15:25:39 daniel
  1120. + Added maxheapsize.
  1121. * Corrected semi-bug in calling the assembler and the linker
  1122. Revision 1.31 1998/09/01 09:07:13 peter
  1123. * m68k fixes, splitted cg68k like cgi386
  1124. Revision 1.30 1998/08/31 12:26:34 peter
  1125. * m68k and palmos updates from surebugfixes
  1126. Revision 1.29 1998/08/26 10:09:21 peter
  1127. * more lowercase extensions
  1128. Revision 1.28 1998/08/25 12:42:47 pierre
  1129. * CDECL changed to CVAR for variables
  1130. specifications are read in structures also
  1131. + started adding GPC compatibility mode ( option -Sp)
  1132. * names changed to lowercase
  1133. Revision 1.27 1998/08/21 15:16:57 peter
  1134. * win32 compiles a bit better, no growheap crash
  1135. Revision 1.26 1998/08/19 16:07:55 jonas
  1136. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1137. Revision 1.25 1998/08/18 09:24:45 pierre
  1138. * small warning position bug fixed
  1139. * support_mmx switches splitting was missing
  1140. * rhide error and warning output corrected
  1141. Revision 1.24 1998/08/17 09:17:54 peter
  1142. * static/shared linking updates
  1143. Revision 1.23 1998/06/25 08:48:20 florian
  1144. * first version of rtti support
  1145. Revision 1.22 1998/06/17 14:10:21 peter
  1146. * small os2 fixes
  1147. * fixed interdependent units with newppu (remake3 under linux works now)
  1148. Revision 1.20 1998/06/15 15:38:14 pierre
  1149. * small bug in systems.pas corrected
  1150. + operators in different units better hanlded
  1151. Revision 1.19 1998/06/15 13:34:24 daniel
  1152. * Fixed spelling mistakes in comments.
  1153. * Fixed some OS/2 parameters.
  1154. Revision 1.18 1998/06/08 22:59:54 peter
  1155. * smartlinking works for win32
  1156. * some defines to exclude some compiler parts
  1157. Revision 1.17 1998/06/04 23:52:04 peter
  1158. * m68k compiles
  1159. + .def file creation moved to gendef.pas so it could also be used
  1160. for win32
  1161. Revision 1.16 1998/06/01 16:50:22 peter
  1162. + boolean -> ord conversion
  1163. * fixed ord -> boolean conversion
  1164. Revision 1.15 1998/05/30 14:31:11 peter
  1165. + $ASMMODE
  1166. Revision 1.14 1998/05/29 13:24:45 peter
  1167. + asw assembler
  1168. Revision 1.13 1998/05/27 00:20:33 peter
  1169. * some scanner optimizes
  1170. * automaticly aout2exe for go32v1
  1171. * fixed dynamiclinker option which was added at the wrong place
  1172. Revision 1.12 1998/05/23 01:21:32 peter
  1173. + aktasmmode, aktoptprocessor, aktoutputformat
  1174. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1175. + $LIBNAME to set the library name where the unit will be put in
  1176. * splitted cgi386 a bit (codeseg to large for bp7)
  1177. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1178. Revision 1.11 1998/05/22 12:32:49 peter
  1179. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1180. Revision 1.10 1998/05/11 13:07:58 peter
  1181. + $ifdef NEWPPU for the new ppuformat
  1182. + $define GDB not longer required
  1183. * removed all warnings and stripped some log comments
  1184. * no findfirst/findnext anymore to remove smartlink *.o files
  1185. Revision 1.9 1998/05/06 08:38:49 pierre
  1186. * better position info with UseTokenInfo
  1187. UseTokenInfo greatly simplified
  1188. + added check for changed tree after first time firstpass
  1189. (if we could remove all the cases were it happen
  1190. we could skip all firstpass if firstpasscount > 1)
  1191. Only with ExtDebug
  1192. Revision 1.8 1998/05/04 20:19:54 peter
  1193. * small fix for go32v2
  1194. Revision 1.7 1998/05/04 17:54:29 peter
  1195. + smartlinking works (only case jumptable left todo)
  1196. * redesign of systems.pas to support assemblers and linkers
  1197. + Unitname is now also in the PPU-file, increased version to 14
  1198. Revision 1.6 1998/05/01 07:43:57 florian
  1199. + basics for rtti implemented
  1200. + switch $m (generate rtti for published sections)
  1201. Revision 1.5 1998/04/29 10:34:06 pierre
  1202. + added some code for ansistring (not complete nor working yet)
  1203. * corrected operator overloading
  1204. * corrected nasm output
  1205. + started inline procedures
  1206. + added starstarn : use ** for exponentiation (^ gave problems)
  1207. + started UseTokenInfo cond to get accurate positions
  1208. Revision 1.4 1998/04/27 15:45:20 peter
  1209. + -Xl for smartlink
  1210. + target_info.arext = .a
  1211. Revision 1.3 1998/04/16 10:50:45 daniel
  1212. * Fixed some things that were broken for OS/2.
  1213. }