systems.pas 39 KB

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