systems.pas 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380
  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-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';
  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-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.47 1998-10-20 08:07:04 pierre
  1116. * several memory corruptions due to double freemem solved
  1117. => never use p^.loc.location:=p^.left^.loc.location;
  1118. + finally I added now by default
  1119. that ra386dir translates global and unit symbols
  1120. + added a first field in tsymtable and
  1121. a nextsym field in tsym
  1122. (this allows to obtain ordered type info for
  1123. records and objects in gdb !)
  1124. Revision 1.46 1998/10/16 08:51:54 peter
  1125. + target_os.stackalignment
  1126. + stack can be aligned at 2 or 4 byte boundaries
  1127. Revision 1.45 1998/10/15 16:20:41 peter
  1128. * removed uses verbose which is not possible! this unit may not use
  1129. any other unit !
  1130. Revision 1.44 1998/10/14 11:28:25 florian
  1131. * emitpushreferenceaddress gets now the asmlist as parameter
  1132. * m68k version compiles with -duseansistrings
  1133. Revision 1.43 1998/10/14 08:08:56 pierre
  1134. * following Peters remark, removed all ifdef in
  1135. the systems unit enums
  1136. * last bugs of cg68k removed for sysamiga
  1137. (sysamiga assembles with as68k !!)
  1138. Revision 1.42 1998/10/13 16:50:23 pierre
  1139. * undid some changes of Peter that made the compiler wrong
  1140. for m68k (I had to reinsert some ifdefs)
  1141. * removed several memory leaks under m68k
  1142. * removed the meory leaks for assembler readers
  1143. * cross compiling shoud work again better
  1144. ( crosscompiling sysamiga works
  1145. but as68k still complain about some code !)
  1146. Revision 1.41 1998/10/13 13:10:31 peter
  1147. * new style for m68k/i386 infos and enums
  1148. Revision 1.40 1998/10/13 09:13:09 pierre
  1149. * assembler type output command line was case sensitive
  1150. Revision 1.39 1998/10/13 08:19:42 pierre
  1151. + source_os is now set correctly for cross-processor compilers
  1152. (tos contains all target_infos and
  1153. we use CPU86 and CPU68 conditionnals to
  1154. get the source operating system
  1155. this only works if you do not undefine
  1156. the source target !!)
  1157. * several cg68k memory leaks fixed
  1158. + started to change the code so that it should be possible to have
  1159. a complete compiler (both for m68k and i386 !!)
  1160. Revision 1.38 1998/10/07 04:26:58 carl
  1161. * bugfixes
  1162. + added mpw support
  1163. Revision 1.37 1998/10/06 20:40:58 peter
  1164. * remove -D from assemblers
  1165. Revision 1.36 1998/09/16 16:41:50 peter
  1166. * merged fixes
  1167. Revision 1.33.2.3 1998/09/16 16:13:13 peter
  1168. * win32 .o -> .ow and .a -> .aw
  1169. Revision 1.35 1998/09/11 17:35:33 peter
  1170. * fixed tabs
  1171. Revision 1.34 1998/09/11 12:27:55 pierre
  1172. * restored m68k part
  1173. Revision 1.33.2.2 1998/09/11 17:29:20 peter
  1174. * fixed tabs
  1175. Revision 1.33.2.1 1998/09/11 12:06:00 pierre
  1176. * m68k part restored
  1177. Revision 1.33 1998/09/10 15:25:39 daniel
  1178. + Added maxheapsize.
  1179. * Corrected semi-bug in calling the assembler and the linker
  1180. Revision 1.31 1998/09/01 09:07:13 peter
  1181. * m68k fixes, splitted cg68k like cgi386
  1182. Revision 1.30 1998/08/31 12:26:34 peter
  1183. * m68k and palmos updates from surebugfixes
  1184. Revision 1.29 1998/08/26 10:09:21 peter
  1185. * more lowercase extensions
  1186. Revision 1.28 1998/08/25 12:42:47 pierre
  1187. * CDECL changed to CVAR for variables
  1188. specifications are read in structures also
  1189. + started adding GPC compatibility mode ( option -Sp)
  1190. * names changed to lowercase
  1191. Revision 1.27 1998/08/21 15:16:57 peter
  1192. * win32 compiles a bit better, no growheap crash
  1193. Revision 1.26 1998/08/19 16:07:55 jonas
  1194. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1195. Revision 1.25 1998/08/18 09:24:45 pierre
  1196. * small warning position bug fixed
  1197. * support_mmx switches splitting was missing
  1198. * rhide error and warning output corrected
  1199. Revision 1.24 1998/08/17 09:17:54 peter
  1200. * static/shared linking updates
  1201. Revision 1.23 1998/06/25 08:48:20 florian
  1202. * first version of rtti support
  1203. Revision 1.22 1998/06/17 14:10:21 peter
  1204. * small os2 fixes
  1205. * fixed interdependent units with newppu (remake3 under linux works now)
  1206. Revision 1.20 1998/06/15 15:38:14 pierre
  1207. * small bug in systems.pas corrected
  1208. + operators in different units better hanlded
  1209. Revision 1.19 1998/06/15 13:34:24 daniel
  1210. * Fixed spelling mistakes in comments.
  1211. * Fixed some OS/2 parameters.
  1212. Revision 1.18 1998/06/08 22:59:54 peter
  1213. * smartlinking works for win32
  1214. * some defines to exclude some compiler parts
  1215. Revision 1.17 1998/06/04 23:52:04 peter
  1216. * m68k compiles
  1217. + .def file creation moved to gendef.pas so it could also be used
  1218. for win32
  1219. Revision 1.16 1998/06/01 16:50:22 peter
  1220. + boolean -> ord conversion
  1221. * fixed ord -> boolean conversion
  1222. Revision 1.15 1998/05/30 14:31:11 peter
  1223. + $ASMMODE
  1224. Revision 1.14 1998/05/29 13:24:45 peter
  1225. + asw assembler
  1226. Revision 1.13 1998/05/27 00:20:33 peter
  1227. * some scanner optimizes
  1228. * automaticly aout2exe for go32v1
  1229. * fixed dynamiclinker option which was added at the wrong place
  1230. Revision 1.12 1998/05/23 01:21:32 peter
  1231. + aktasmmode, aktoptprocessor, aktoutputformat
  1232. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1233. + $LIBNAME to set the library name where the unit will be put in
  1234. * splitted cgi386 a bit (codeseg to large for bp7)
  1235. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1236. Revision 1.11 1998/05/22 12:32:49 peter
  1237. * fixed -L on the commandline, Dos commandline is only 128 bytes
  1238. Revision 1.10 1998/05/11 13:07:58 peter
  1239. + $ifdef NEWPPU for the new ppuformat
  1240. + $define GDB not longer required
  1241. * removed all warnings and stripped some log comments
  1242. * no findfirst/findnext anymore to remove smartlink *.o files
  1243. Revision 1.9 1998/05/06 08:38:49 pierre
  1244. * better position info with UseTokenInfo
  1245. UseTokenInfo greatly simplified
  1246. + added check for changed tree after first time firstpass
  1247. (if we could remove all the cases were it happen
  1248. we could skip all firstpass if firstpasscount > 1)
  1249. Only with ExtDebug
  1250. Revision 1.8 1998/05/04 20:19:54 peter
  1251. * small fix for go32v2
  1252. Revision 1.7 1998/05/04 17:54:29 peter
  1253. + smartlinking works (only case jumptable left todo)
  1254. * redesign of systems.pas to support assemblers and linkers
  1255. + Unitname is now also in the PPU-file, increased version to 14
  1256. Revision 1.6 1998/05/01 07:43:57 florian
  1257. + basics for rtti implemented
  1258. + switch $m (generate rtti for published sections)
  1259. Revision 1.5 1998/04/29 10:34:06 pierre
  1260. + added some code for ansistring (not complete nor working yet)
  1261. * corrected operator overloading
  1262. * corrected nasm output
  1263. + started inline procedures
  1264. + added starstarn : use ** for exponentiation (^ gave problems)
  1265. + started UseTokenInfo cond to get accurate positions
  1266. Revision 1.4 1998/04/27 15:45:20 peter
  1267. + -Xl for smartlink
  1268. + target_info.arext = .a
  1269. Revision 1.3 1998/04/16 10:50:45 daniel
  1270. * Fixed some things that were broken for OS/2.
  1271. }