systems.pas 57 KB

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