systems.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. This unit contains information about the target systems supported
  4. (these are not processor specific)
  5. This program is free software; you can redistribute it and/or modify
  6. iu under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge- MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit systems;
  19. {$i fpcdefs.inc}
  20. interface
  21. type
  22. tendian = (endian_little,endian_big);
  23. (*
  24. IMPORTANT NOTE:
  25. The value of this enumeration is stored in PPU files.
  26. Therefore adding new CPU targets should not change the
  27. values of the pre-existing targets. (CEC)
  28. FURTHERMORE : Make sure that this branch values, are
  29. consistant with the main branch version always.
  30. *)
  31. tsystemcpu=
  32. (
  33. cpu_no, { 0 }
  34. cpu_i386, { 1 }
  35. cpu_m68k, { 2 }
  36. cpu_alpha, { 3 }
  37. cpu_powerpc, { 4 }
  38. cpu_sparc, { 5 }
  39. cpu_vm, { 6 }
  40. cpu_iA64, { 7 }
  41. cpu_x86_64, { 8 }
  42. cpu_mips, { 9 }
  43. cpu_arm, { 10 }
  44. cpu_powerpc64 { 11 }
  45. );
  46. tasmmode= (asmmode_none
  47. { standard assembler (cpu dependant) with full parsing }
  48. ,asmmode_standard
  49. ,asmmode_i386_att
  50. ,asmmode_i386_intel
  51. ,asmmode_ppc_gas
  52. ,asmmode_ppc_motorola
  53. ,asmmode_arm_gas
  54. ,asmmode_sparc_gas
  55. ,asmmode_x86_64_gas
  56. ,asmmode_m68k_mot
  57. );
  58. (* IMPORTANT NOTE:
  59. the integer value of this enum is stored in PPU
  60. files to recognize the target, so if you add new targets
  61. allways add them at end PM
  62. FURTHERMORE : Make sure that this branch values are
  63. consistant with the main branch version always. (CEC)
  64. *)
  65. type
  66. tsystem =
  67. (
  68. system_none, { 0 }
  69. obsolete_system_i386_GO32V1,{ 1 }
  70. system_i386_GO32V2, { 2 }
  71. system_i386_linux, { 3 }
  72. system_i386_OS2, { 4 }
  73. system_i386_Win32, { 5 }
  74. system_i386_freebsd, { 6 }
  75. system_m68k_Amiga, { 7 }
  76. system_m68k_Atari, { 8 }
  77. system_m68k_Mac, { 9 }
  78. system_m68k_linux, { 10 }
  79. system_m68k_PalmOS, { 11 }
  80. system_alpha_linux, { 12 }
  81. system_powerpc_linux, { 13 }
  82. system_powerpc_macos, { 14 }
  83. system_i386_solaris, { 15 }
  84. system_i386_beos, { 16 }
  85. system_i386_netbsd, { 17 }
  86. system_m68k_netbsd, { 18 }
  87. system_i386_Netware, { 19 }
  88. system_i386_qnx, { 20 }
  89. system_i386_wdosx, { 21 }
  90. system_sparc_solaris, { 22 }
  91. system_sparc_linux, { 23 }
  92. system_i386_openbsd, { 24 }
  93. system_m68k_openbsd, { 25 }
  94. system_x86_64_linux, { 26 }
  95. system_powerpc_darwin, { 27 }
  96. system_i386_EMX, { 28 }
  97. system_powerpc_netbsd, { 29 }
  98. system_powerpc_openbsd, { 30 }
  99. system_arm_linux, { 31 }
  100. system_i386_watcom, { 32 }
  101. system_powerpc_MorphOS, { 33 }
  102. system_x86_64_freebsd, { 34 }
  103. system_i386_netwlibc, { 35 }
  104. system_powerpc_Amiga, { 36 }
  105. system_x86_64_win64, { 37 }
  106. system_arm_wince, { 38 }
  107. system_ia64_win64, { 39 }
  108. system_i386_wince, { 40 }
  109. system_x86_6432_linux, { 41 }
  110. system_arm_gba, { 42 }
  111. system_powerpc64_linux { 43 }
  112. );
  113. tasm = (as_none
  114. ,as_gas { standard gnu assembler }
  115. ,as_i386_as_aout
  116. ,as_i386_nasmcoff
  117. ,as_i386_nasmwin32
  118. ,as_i386_nasmwdosx
  119. ,as_i386_nasmelf
  120. ,as_i386_nasmobj
  121. ,as_i386_nasmbeos
  122. ,as_i386_tasm
  123. ,as_i386_masm
  124. ,as_i386_wasm
  125. ,as_i386_coff
  126. ,as_i386_pecoff
  127. ,as_i386_elf32
  128. ,as_i386_pecoffwdosx
  129. ,as_m68k_mit
  130. ,as_powerpc_mpw
  131. ,as_darwin
  132. ,as_x86_64_masm
  133. ,as_x86_64_pecoff
  134. ,as_i386_pecoffwince
  135. ,as_arm_pecoffwince
  136. );
  137. tar = (ar_none
  138. ,ar_gnu_ar,ar_mpw_ar
  139. );
  140. tres = (res_none
  141. ,res_gnu_windres,res_emxbind
  142. ,res_m68k_palmos,res_m68k_mpw
  143. ,res_powerpc_mpw,res_elf
  144. ,res_gnu_wince_windres
  145. );
  146. tdbg = (dbg_none
  147. ,dbg_stabs,dbg_dwarf
  148. );
  149. tscripttype = (script_none
  150. ,script_dos,script_unix,script_amiga,
  151. script_mpw
  152. );
  153. tabi = (abi_default
  154. ,abi_powerpc_sysv,abi_powerpc_aix
  155. );
  156. {*****************************************************************************
  157. Structures
  158. *****************************************************************************}
  159. type
  160. { Abstract linker class which is implemented in link module }
  161. TAbstractLinker = class
  162. end;
  163. TAbstractLinkerClass = class of TAbstractLinker;
  164. { Abstract assembler class which is implemented in assemble module }
  165. TAbstractAssembler = class
  166. end;
  167. TAbstractAssemblerClass = class of TAbstractAssembler;
  168. palignmentinfo = ^talignmentinfo;
  169. talignmentinfo = record
  170. procalign,
  171. loopalign,
  172. jumpalign,
  173. constalignmin,
  174. constalignmax,
  175. varalignmin,
  176. varalignmax,
  177. localalignmin,
  178. localalignmax,
  179. recordalignmin,
  180. recordalignmax,
  181. maxCrecordalign : longint;
  182. end;
  183. tasmflags = (af_none,
  184. af_outputbinary,af_allowdirect,
  185. af_needar,af_smartlink_sections,
  186. af_labelprefix_only_inside_procedure,
  187. af_supports_dwarf
  188. );
  189. pasminfo = ^tasminfo;
  190. tasminfo = record
  191. id : tasm;
  192. idtxt : string[12];
  193. asmbin : string[8];
  194. asmcmd : string[50];
  195. supported_target : tsystem;
  196. flags : set of tasmflags;
  197. labelprefix : string[3];
  198. comment : string[3];
  199. end;
  200. parinfo = ^tarinfo;
  201. tarinfo = record
  202. id : tar;
  203. arcmd : string[50];
  204. end;
  205. presinfo = ^tresinfo;
  206. tresinfo = record
  207. id : tres;
  208. resbin : string[8];
  209. rescmd : string[50];
  210. end;
  211. pdbginfo = ^tdbginfo;
  212. tdbginfo = record
  213. id : tdbg;
  214. idtxt : string[12];
  215. end;
  216. tsystemflags = (tf_none,
  217. tf_under_development,
  218. tf_need_export,tf_needs_isconsole,
  219. tf_code_small,tf_static_reg_based,
  220. tf_needs_symbol_size,
  221. tf_smartlink_sections,
  222. tf_needs_dwarf_cfi,
  223. tf_use_8_3,
  224. tf_pic_uses_got,
  225. tf_library_needs_pic
  226. );
  227. psysteminfo = ^tsysteminfo;
  228. { using packed causes bus errors on processors which require alignment }
  229. tsysteminfo = record
  230. system : tsystem;
  231. name : string[34];
  232. shortname : string[9];
  233. flags : set of tsystemflags;
  234. cpu : tsystemcpu;
  235. unit_env : string[16];
  236. extradefines : string[40];
  237. exeext,
  238. defext,
  239. scriptext,
  240. smartext,
  241. unitext,
  242. unitlibext,
  243. asmext,
  244. objext,
  245. resext,
  246. resobjext : string[4];
  247. sharedlibext : string[10];
  248. staticlibext,
  249. staticlibprefix : string[4];
  250. sharedlibprefix : string[4];
  251. sharedClibext : string[10];
  252. staticClibext,
  253. staticClibprefix : string[4];
  254. sharedClibprefix : string[4];
  255. p_ext_support:Boolean; {Whether extension .p is supported by default}
  256. Cprefix : string[2];
  257. newline : string[2];
  258. dirsep : char;
  259. files_case_relevent : boolean;
  260. assem : tasm;
  261. assemextern : tasm; { external assembler, used by -a }
  262. link : tabstractlinkerclass;
  263. linkextern : tabstractlinkerclass; { external linker, used by -s }
  264. ar : tar;
  265. res : tres;
  266. dbg : tdbg;
  267. script : tscripttype;
  268. endian : tendian;
  269. alignment : talignmentinfo;
  270. {
  271. Offset from the argument pointer register to the first
  272. argument's address. On some machines it may depend on
  273. the data type of the function.
  274. (see also FIRST_PARM_OFFSET in GCC source)
  275. }
  276. first_parm_offset : longint;
  277. stacksize : longint;
  278. DllScanSupported : boolean;
  279. use_function_relative_addresses : boolean;
  280. abi : tabi;
  281. end;
  282. const
  283. { alias for supported_target field in tasminfo }
  284. system_any = system_none;
  285. system_wince : set of tsystem = [system_arm_wince,system_i386_wince];
  286. system_linux : set of tsystem = [system_i386_linux,system_x86_64_linux,system_powerpc_linux,
  287. system_arm_linux,system_sparc_linux,system_alpha_linux,system_m68k_linux,
  288. system_x86_6432_linux];
  289. { all real windows systems, no cripple ones like wince, wdosx et. al. }
  290. system_windows : set of tsystem = [system_i386_win32,system_x86_64_win64,system_ia64_win64];
  291. cpu2str : array[TSystemCpu] of string =
  292. ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
  293. 'mips','arm', 'powerpc64');
  294. var
  295. targetinfos : array[tsystem] of psysteminfo;
  296. arinfos : array[tar] of parinfo;
  297. resinfos : array[tres] of presinfo;
  298. asminfos : array[tasm] of pasminfo;
  299. dbginfos : array[tdbg] of pdbginfo;
  300. source_info : tsysteminfo;
  301. target_cpu : tsystemcpu;
  302. target_info : tsysteminfo;
  303. target_asm : tasminfo;
  304. target_ar : tarinfo;
  305. target_res : tresinfo;
  306. target_dbg : tdbginfo;
  307. target_cpu_string,
  308. target_os_string : string[12]; { for rtl/<X>/,fcl/<X>/, etc. }
  309. target_full_string : string[24];
  310. function set_target(t:tsystem):boolean;
  311. function set_target_asm(t:tasm):boolean;
  312. function set_target_ar(t:tar):boolean;
  313. function set_target_res(t:tres):boolean;
  314. function set_target_dbg(t:tdbg):boolean;
  315. function find_system_by_string(const s : string) : tsystem;
  316. function find_asm_by_string(const s : string) : tasm;
  317. function find_dbg_by_string(const s : string) : tdbg;
  318. procedure set_source_info(const ti : tsysteminfo);
  319. procedure UpdateAlignment(var d:talignmentinfo;const s:talignmentinfo);
  320. procedure RegisterTarget(const r:tsysteminfo);
  321. procedure RegisterRes(const r:tresinfo);
  322. procedure RegisterAr(const r:tarinfo);
  323. { Register the external linker. This routine is called to setup the
  324. class to use for the linker. It returns the tsysteminfo structure
  325. updated with the correct linker class for external linking.
  326. }
  327. procedure RegisterExternalLinker(var system_info: tsysteminfo; c:TAbstractLinkerClass);
  328. { Register the internal linker. This routine is called to setup the
  329. class to use for the linker. It returns the tsysteminfo structure
  330. updated with the correct linker class for internal linking.
  331. If internal linking is not supported, this class can be set
  332. to nil.
  333. }
  334. procedure RegisterInternalLinker(var system_info : tsysteminfo; c:TAbstractLinkerClass);
  335. procedure InitSystems;
  336. {$ifdef FreeBSD}
  337. function GetOSRelDate:Longint;
  338. {$endif}
  339. implementation
  340. uses
  341. cutils{$ifdef FreeBSD},SysCtl,BaseUnix{$endif};
  342. {****************************************************************************
  343. OS runtime version detection utility routine
  344. ****************************************************************************}
  345. {$ifdef FreeBSD}
  346. function GetOSRelDate:Longint;
  347. var
  348. mib : array[0..1] of cint;
  349. rval : cint;
  350. len : size_t;
  351. i : longint;
  352. v : longint;
  353. oerrno : cint;
  354. S : AnsiString;
  355. Begin
  356. s:='ab';
  357. SetLength(S,50);
  358. mib[0] := CTL_KERN;
  359. mib[1] := KERN_OSRELDATE;
  360. len := 4;
  361. oerrno:= fpgeterrno;
  362. if (FPsysctl(@mib, 2, pchar(@v), @len, NIL, 0) = -1) Then
  363. Begin
  364. if (fpgeterrno = ESysENOMEM) Then
  365. fpseterrno(oerrno);
  366. GetOSRelDate:=0;
  367. End
  368. else
  369. GetOSRelDate:=v;
  370. End;
  371. {$endif}
  372. {****************************************************************************
  373. Target setting
  374. ****************************************************************************}
  375. function set_target(t:tsystem):boolean;
  376. begin
  377. set_target:=false;
  378. if assigned(targetinfos[t]) then
  379. begin
  380. target_info:=targetinfos[t]^;
  381. set_target_asm(target_info.assem);
  382. set_target_ar(target_info.ar);
  383. set_target_res(target_info.res);
  384. set_target_dbg(target_info.dbg);
  385. target_cpu:=target_info.cpu;
  386. target_os_string:=lower(target_info.shortname);
  387. target_cpu_string:=cpu2str[target_cpu];
  388. target_full_string:=target_cpu_string+'-'+target_os_string;
  389. set_target:=true;
  390. exit;
  391. end;
  392. end;
  393. function set_target_asm(t:tasm):boolean;
  394. begin
  395. set_target_asm:=false;
  396. if assigned(asminfos[t]) and
  397. ((asminfos[t]^.supported_target=target_info.system) or
  398. (asminfos[t]^.supported_target=system_any)) then
  399. begin
  400. target_asm:=asminfos[t]^;
  401. set_target_asm:=true;
  402. exit;
  403. end;
  404. end;
  405. function set_target_ar(t:tar):boolean;
  406. begin
  407. result:=false;
  408. if assigned(arinfos[t]) then
  409. begin
  410. target_ar:=arinfos[t]^;
  411. result:=true;
  412. exit;
  413. end;
  414. end;
  415. function set_target_res(t:tres):boolean;
  416. begin
  417. result:=false;
  418. if assigned(resinfos[t]) then
  419. begin
  420. target_res:=resinfos[t]^;
  421. result:=true;
  422. exit;
  423. end;
  424. end;
  425. function set_target_dbg(t:tdbg):boolean;
  426. begin
  427. result:=false;
  428. if assigned(dbginfos[t]) then
  429. begin
  430. target_dbg:=dbginfos[t]^;
  431. result:=true;
  432. exit;
  433. end;
  434. end;
  435. function find_system_by_string(const s : string) : tsystem;
  436. var
  437. hs : string;
  438. t : tsystem;
  439. begin
  440. result:=system_none;
  441. hs:=upper(s);
  442. for t:=low(tsystem) to high(tsystem) do
  443. if assigned(targetinfos[t]) and
  444. (upper(targetinfos[t]^.shortname)=hs) then
  445. begin
  446. result:=t;
  447. exit;
  448. end;
  449. end;
  450. function find_asm_by_string(const s : string) : tasm;
  451. var
  452. hs : string;
  453. t : tasm;
  454. begin
  455. result:=as_none;
  456. hs:=upper(s);
  457. for t:=low(tasm) to high(tasm) do
  458. if assigned(asminfos[t]) and
  459. (asminfos[t]^.idtxt=hs) then
  460. begin
  461. result:=t;
  462. exit;
  463. end;
  464. end;
  465. function find_dbg_by_string(const s : string) : tdbg;
  466. var
  467. hs : string;
  468. t : tdbg;
  469. begin
  470. result:=dbg_none;
  471. hs:=upper(s);
  472. for t:=low(tdbg) to high(tdbg) do
  473. if assigned(dbginfos[t]) and
  474. (dbginfos[t]^.idtxt=hs) then
  475. begin
  476. result:=t;
  477. exit;
  478. end;
  479. end;
  480. procedure UpdateAlignment(var d:talignmentinfo;const s:talignmentinfo);
  481. begin
  482. with d do
  483. begin
  484. { general update rules:
  485. minimum: if higher then update
  486. maximum: if lower then update or if undefined then update }
  487. if s.procalign>procalign then
  488. procalign:=s.procalign;
  489. if s.loopalign>loopalign then
  490. loopalign:=s.loopalign;
  491. if s.jumpalign>jumpalign then
  492. jumpalign:=s.jumpalign;
  493. if s.constalignmin>constalignmin then
  494. constalignmin:=s.constalignmin;
  495. if (constalignmax=0) or
  496. ((s.constalignmax>0) and (s.constalignmax<constalignmax)) then
  497. constalignmax:=s.constalignmax;
  498. if s.varalignmin>varalignmin then
  499. varalignmin:=s.varalignmin;
  500. if (varalignmax=0) or
  501. ((s.varalignmax>0) and (s.varalignmax<varalignmax)) then
  502. varalignmax:=s.varalignmax;
  503. if s.localalignmin>localalignmin then
  504. localalignmin:=s.localalignmin;
  505. if (localalignmax=0) or
  506. ((s.localalignmax>0) and (s.localalignmax<localalignmax)) then
  507. localalignmax:=s.localalignmax;
  508. if s.recordalignmin>recordalignmin then
  509. recordalignmin:=s.recordalignmin;
  510. if (recordalignmax=0) or
  511. ((s.recordalignmax>0) and (s.recordalignmax<recordalignmax)) then
  512. recordalignmax:=s.recordalignmax;
  513. if (maxCrecordalign=0) or
  514. ((s.maxCrecordalign>0) and (s.maxCrecordalign<maxCrecordalign)) then
  515. maxCrecordalign:=s.maxCrecordalign;
  516. end;
  517. end;
  518. {****************************************************************************
  519. Target registration
  520. ****************************************************************************}
  521. procedure RegisterTarget(const r:tsysteminfo);
  522. var
  523. t : tsystem;
  524. begin
  525. t:=r.system;
  526. if assigned(targetinfos[t]) then
  527. writeln('Warning: Target is already registered!')
  528. else
  529. Getmem(targetinfos[t],sizeof(tsysteminfo));
  530. targetinfos[t]^:=r;
  531. end;
  532. procedure RegisterRes(const r:tresinfo);
  533. var
  534. t : tres;
  535. begin
  536. t:=r.id;
  537. if assigned(resinfos[t]) then
  538. writeln('Warning: resourcecompiler is already registered!')
  539. else
  540. Getmem(resinfos[t],sizeof(tresinfo));
  541. resinfos[t]^:=r;
  542. end;
  543. procedure RegisterAr(const r:tarinfo);
  544. var
  545. t : tar;
  546. begin
  547. t:=r.id;
  548. if assigned(arinfos[t]) then
  549. writeln('Warning: ar is already registered!')
  550. else
  551. Getmem(arinfos[t],sizeof(tarinfo));
  552. arinfos[t]^:=r;
  553. end;
  554. procedure RegisterExternalLinker(var system_info: tsysteminfo; c:TAbstractLinkerClass);
  555. begin
  556. system_info.linkextern := c;
  557. end;
  558. procedure RegisterInternalLinker(var system_info : tsysteminfo; c:TAbstractLinkerClass);
  559. begin
  560. system_info.link := c;
  561. end;
  562. procedure DeregisterInfos;
  563. var
  564. assem : tasm;
  565. target : tsystem;
  566. ar : tar;
  567. res : tres;
  568. begin
  569. for target:=low(tsystem) to high(tsystem) do
  570. if assigned(targetinfos[target]) then
  571. begin
  572. freemem(targetinfos[target],sizeof(tsysteminfo));
  573. targetinfos[target]:=nil;
  574. end;
  575. for assem:=low(tasm) to high(tasm) do
  576. if assigned(asminfos[assem]) then
  577. begin
  578. freemem(asminfos[assem],sizeof(tasminfo));
  579. asminfos[assem]:=nil;
  580. end;
  581. for ar:=low(tar) to high(tar) do
  582. if assigned(arinfos[ar]) then
  583. begin
  584. freemem(arinfos[ar],sizeof(tarinfo));
  585. arinfos[ar]:=nil;
  586. end;
  587. for res:=low(tres) to high(tres) do
  588. if assigned(resinfos[res]) then
  589. begin
  590. freemem(resinfos[res],sizeof(tresinfo));
  591. resinfos[res]:=nil;
  592. end;
  593. end;
  594. {****************************************************************************
  595. Initialization of default target
  596. ****************************************************************************}
  597. procedure default_target(t:tsystem);
  598. begin
  599. set_target(t);
  600. if source_info.name='' then
  601. source_info:=target_info;
  602. end;
  603. procedure set_source_info(const ti : tsysteminfo);
  604. begin
  605. { can't use message() here (PFV) }
  606. if source_info.name<>'' then
  607. Writeln('Warning: Source OS Redefined!');
  608. source_info:=ti;
  609. end;
  610. procedure InitSystems;
  611. begin
  612. { Now default target, this is dependent on the target cpu define,
  613. when the define is the same as the source cpu then we use the source
  614. os, else we pick a default }
  615. {$ifdef i386}
  616. {$ifdef cpu86}
  617. default_target(source_info.system);
  618. {$else cpu86}
  619. {$ifdef linux}
  620. default_target(system_i386_linux);
  621. {$endif}
  622. {$ifdef freebsd}
  623. default_target(system_i386_freebsd);
  624. {$endif}
  625. {$endif cpu86}
  626. {$endif i386}
  627. {$ifdef x86_64}
  628. {$ifdef cpux86_64}
  629. default_target(source_info.system);
  630. {$define source_system_set}
  631. {$else cpux86_64}
  632. {$ifdef linux}
  633. default_target(system_x86_64_linux);
  634. {$define source_system_set}
  635. {$endif}
  636. {$ifdef freebsd}
  637. default_target(system_x86_64_freebsd);
  638. {$define source_system_set}
  639. {$endif}
  640. { default is linux }
  641. {$ifndef source_system_set}
  642. default_target(system_x86_64_linux);
  643. {$endif source_system_set}
  644. {$endif cpux86_64}
  645. {$endif x86_64}
  646. {$ifdef m68k}
  647. {$ifdef cpu68}
  648. default_target(source_info.target);
  649. {$else cpu68}
  650. default_target(system_m68k_linux);
  651. {$endif cpu68}
  652. {$endif m68k}
  653. {$ifdef alpha}
  654. {$ifdef cpualpha}
  655. default_target(source_info.system);
  656. {$else cpualpha}
  657. default_target(system_alpha_linux);
  658. {$endif cpualpha}
  659. {$endif alpha}
  660. {$ifdef powerpc}
  661. {$ifdef cpupowerpc}
  662. default_target(source_info.system);
  663. {$else cpupowerpc}
  664. default_target(system_powerpc_linux);
  665. {$endif cpupowerpc}
  666. {$endif powerpc}
  667. {$ifdef POWERPC64}
  668. {$ifdef cpupowerpc64}
  669. default_target(source_info.system);
  670. {$else cpupowerpc64}
  671. default_target(system_powerpc64_linux);
  672. {$endif cpupowerpc64}
  673. {$endif POWERPC64}
  674. {$ifdef sparc}
  675. {$ifdef cpusparc}
  676. default_target(source_info.system);
  677. {$else cpusparc}
  678. default_target(system_sparc_linux);
  679. {$endif cpusparc}
  680. {$endif sparc}
  681. {$ifdef arm}
  682. {$ifdef cpuarm}
  683. default_target(source_info.system);
  684. {$else cpuarm}
  685. default_target(system_arm_linux);
  686. {$endif cpuarm}
  687. {$endif arm}
  688. end;
  689. initialization
  690. source_info.name:='';
  691. finalization
  692. DeregisterInfos;
  693. end.