systems.pas 57 KB

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