systems.pas 40 KB

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