t_linux.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. {
  2. Copyright (c) 1998-2002 by Peter Vreman
  3. This unit implements support import,export,link routines
  4. for the (i386) Linux target
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 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 t_linux;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. symsym,symdef,ppu,
  23. import,export,link;
  24. type
  25. timportliblinux=class(timportlib)
  26. procedure preparelib(const s:string);override;
  27. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  28. procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
  29. procedure generatelib;override;
  30. end;
  31. texportliblinux=class(texportlib)
  32. procedure preparelib(const s : string);override;
  33. procedure exportprocedure(hp : texported_item);override;
  34. procedure exportvar(hp : texported_item);override;
  35. procedure generatelib;override;
  36. end;
  37. tlinkerlinux=class(texternallinker)
  38. private
  39. libctype:(libc5,glibc2,glibc21,uclibc);
  40. Function WriteResponseFile(isdll:boolean) : Boolean;
  41. public
  42. constructor Create;override;
  43. procedure SetDefaultInfo;override;
  44. function MakeExecutable:boolean;override;
  45. function MakeSharedLibrary:boolean;override;
  46. function postprocessexecutable(const fn : string;isdll:boolean):boolean;
  47. end;
  48. implementation
  49. uses
  50. cutils,cclasses,
  51. verbose,systems,globtype,globals,
  52. symconst,script,
  53. fmodule,dos,
  54. aasmbase,aasmtai,aasmcpu,cpubase,
  55. cgbase,cgobj,cgutils,
  56. i_linux
  57. ;
  58. {*****************************************************************************
  59. TIMPORTLIBLINUX
  60. *****************************************************************************}
  61. procedure timportliblinux.preparelib(const s : string);
  62. begin
  63. end;
  64. procedure timportliblinux.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
  65. begin
  66. { insert sharedlibrary }
  67. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  68. end;
  69. procedure timportliblinux.importvariable(vs:tglobalvarsym;const name,module:string);
  70. begin
  71. { insert sharedlibrary }
  72. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  73. { reset the mangledname and turn off the dll_var option }
  74. vs.set_mangledname(name);
  75. exclude(vs.varoptions,vo_is_dll_var);
  76. end;
  77. procedure timportliblinux.generatelib;
  78. begin
  79. end;
  80. {*****************************************************************************
  81. TEXPORTLIBLINUX
  82. *****************************************************************************}
  83. procedure texportliblinux.preparelib(const s:string);
  84. begin
  85. end;
  86. procedure texportliblinux.exportprocedure(hp : texported_item);
  87. var
  88. hp2 : texported_item;
  89. begin
  90. { first test the index value }
  91. if (hp.options and eo_index)<>0 then
  92. begin
  93. Message1(parser_e_no_export_with_index_for_target,'linux');
  94. exit;
  95. end;
  96. { now place in correct order }
  97. hp2:=texported_item(current_module._exports.first);
  98. while assigned(hp2) and
  99. (hp.name^>hp2.name^) do
  100. hp2:=texported_item(hp2.next);
  101. { insert hp there !! }
  102. if assigned(hp2) and (hp2.name^=hp.name^) then
  103. begin
  104. { this is not allowed !! }
  105. Message1(parser_e_export_name_double,hp.name^);
  106. exit;
  107. end;
  108. if hp2=texported_item(current_module._exports.first) then
  109. current_module._exports.concat(hp)
  110. else if assigned(hp2) then
  111. begin
  112. hp.next:=hp2;
  113. hp.previous:=hp2.previous;
  114. if assigned(hp2.previous) then
  115. hp2.previous.next:=hp;
  116. hp2.previous:=hp;
  117. end
  118. else
  119. current_module._exports.concat(hp);
  120. end;
  121. procedure texportliblinux.exportvar(hp : texported_item);
  122. begin
  123. hp.is_var:=true;
  124. exportprocedure(hp);
  125. end;
  126. procedure texportliblinux.generatelib;
  127. var
  128. hp2 : texported_item;
  129. sym : tasmsymbol;
  130. r : treference;
  131. begin
  132. new_section(codesegment,sec_code,'',0);
  133. hp2:=texported_item(current_module._exports.first);
  134. while assigned(hp2) do
  135. begin
  136. if (not hp2.is_var) and
  137. (hp2.sym.typ=procsym) then
  138. begin
  139. { the manglednames can already be the same when the procedure
  140. is declared with cdecl }
  141. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  142. begin
  143. { place jump in codesegment }
  144. codesegment.concat(tai_align.create(target_info.alignment.procalign));
  145. codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  146. if (cs_create_pic in aktmoduleswitches) and
  147. { other targets need to be checked how it works }
  148. (target_info.system in [system_x86_64_linux]) then
  149. begin
  150. {$ifdef x86_64}
  151. sym:=objectlibrary.newasmsymbol(hp2.name^,AB_EXTERNAL,AT_FUNCTION);
  152. reference_reset_symbol(r,sym,0);
  153. if cs_create_pic in aktmoduleswitches then
  154. r.refaddr:=addr_pic
  155. else
  156. r.refaddr:=addr_full;
  157. codesegment.concat(taicpu.op_ref(A_JMP,S_NO,r));
  158. {$endif x86_64}
  159. end
  160. else
  161. cg.a_jmp_name(codesegment,tprocsym(hp2.sym).first_procdef.mangledname);
  162. codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
  163. end;
  164. end
  165. else
  166. Message1(parser_e_no_export_of_variables_for_target,'linux');
  167. hp2:=texported_item(hp2.next);
  168. end;
  169. end;
  170. {*****************************************************************************
  171. TLINKERLINUX
  172. *****************************************************************************}
  173. Constructor TLinkerLinux.Create;
  174. begin
  175. Inherited Create;
  176. if not Dontlinkstdlibpath Then
  177. {$ifdef x86_64}
  178. LibrarySearchPath.AddPath('/lib64;/usr/lib64;/usr/X11R6/lib64',true);
  179. {$else}
  180. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
  181. {$endif x86_64}
  182. end;
  183. procedure TLinkerLinux.SetDefaultInfo;
  184. {
  185. This will also detect which libc version will be used
  186. }
  187. const
  188. {$ifdef i386} platform_select='-b elf32-i386 -m elf_i386';{$endif}
  189. {$ifdef x86_64} platform_select='-b elf64-x86-64 -m elf_x86_64';{$endif}
  190. {$ifdef powerpc}platform_select='-b elf32-powerpc -m elf32ppclinux';{$endif}
  191. {$ifdef sparc} platform_select='-b elf32-sparc -m elf32_sparc';{$endif}
  192. {$ifdef arm} platform_select='';{$endif} {unknown :( }
  193. {$ifdef m68k}
  194. var
  195. St : SearchRec;
  196. {$endif m68k}
  197. begin
  198. with Info do
  199. begin
  200. ExeCmd[1]:='ld '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
  201. DllCmd[1]:='ld '+platform_select+' $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES -E';
  202. DllCmd[2]:='strip --strip-unneeded $EXE';
  203. {$ifdef m68k}
  204. libctype:=glibc2;
  205. FindFirst('/lib/ld*',AnyFile,st);
  206. while DosError=0 do
  207. begin
  208. if copy(st.name,1,5)='ld-2.' then
  209. begin
  210. DynamicLinker:='/lib/'+St.name;
  211. if st.name[6]<>'0' then
  212. libctype:=glibc21;
  213. break;
  214. end;
  215. FindNext(St);
  216. end;
  217. FindClose(St);
  218. {$endif m68k}
  219. {$ifdef i386}
  220. { first try glibc2 }
  221. DynamicLinker:='/lib/ld-linux.so.2';
  222. if FileExists(DynamicLinker) then
  223. { Check for 2.0 files, else use the glibc 2.1 stub }
  224. if FileExists('/lib/ld-2.0.*') then
  225. libctype:=glibc2
  226. else
  227. libctype:=glibc21
  228. else
  229. if fileexists('/lib/ld-uClibc.so.0') then
  230. begin
  231. libctype:=uclibc;
  232. dynamiclinker:='/lib/ld-uClibc.so.0';
  233. end
  234. else if fileexists('/lib/ld-linux.so.1') then
  235. DynamicLinker:='/lib/ld-linux.so.1'
  236. else
  237. libctype:=glibc21;
  238. {$endif i386}
  239. {$ifdef x86_64}
  240. DynamicLinker:='/lib64/ld-linux-x86-64.so.2';
  241. libctype:=glibc2;
  242. {$endif x86_64}
  243. {$ifdef sparc}
  244. DynamicLinker:='/lib/ld-linux.so.2';
  245. libctype:=glibc2;
  246. {$endif sparc}
  247. {$ifdef powerpc}
  248. DynamicLinker:='/lib/ld.so.1';
  249. libctype:=glibc2;
  250. {$endif powerpc}
  251. {$ifdef arm}
  252. DynamicLinker:='/lib/ld-linux.so.2';
  253. libctype:=glibc2;
  254. {$endif arm}
  255. end;
  256. end;
  257. Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
  258. Var
  259. linkres : TLinkRes;
  260. i : longint;
  261. cprtobj,
  262. gprtobj,
  263. prtobj : string[80];
  264. HPath : TStringListItem;
  265. s,s1,s2 : string;
  266. found1,
  267. found2,
  268. linklibc : boolean;
  269. begin
  270. WriteResponseFile:=False;
  271. { set special options for some targets }
  272. linklibc:=(SharedLibFiles.Find('c')<>nil);
  273. if isdll then
  274. begin
  275. prtobj:='dllprt0';
  276. cprtobj:='dllprt0';
  277. gprtobj:='dllprt0';
  278. end
  279. else
  280. begin
  281. prtobj:='prt0';
  282. case libctype of
  283. glibc21:
  284. begin
  285. cprtobj:='cprt21';
  286. gprtobj:='gprt21';
  287. end;
  288. uclibc:
  289. begin
  290. cprtobj:='ucprt0';
  291. gprtobj:='ugprt0';
  292. end
  293. else
  294. cprtobj:='cprt0';
  295. gprtobj:='gprt0';
  296. end;
  297. end;
  298. if cs_profile in aktmoduleswitches then
  299. begin
  300. prtobj:=gprtobj;
  301. if not(libctype in [glibc2,glibc21]) then
  302. AddSharedLibrary('gmon');
  303. AddSharedLibrary('c');
  304. linklibc:=true;
  305. end
  306. else
  307. begin
  308. if linklibc then
  309. prtobj:=cprtobj;
  310. end;
  311. { Open link.res file }
  312. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
  313. { Write path to search libraries }
  314. HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
  315. while assigned(HPath) do
  316. begin
  317. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  318. HPath:=TStringListItem(HPath.Next);
  319. end;
  320. HPath:=TStringListItem(LibrarySearchPath.First);
  321. while assigned(HPath) do
  322. begin
  323. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  324. HPath:=TStringListItem(HPath.Next);
  325. end;
  326. LinkRes.Add('INPUT(');
  327. { add objectfiles, start with prt0 always }
  328. if prtobj<>'' then
  329. LinkRes.AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
  330. { try to add crti and crtbegin if linking to C }
  331. if linklibc then
  332. begin
  333. if librarysearchpath.FindFile('crtbegin.o',s) then
  334. LinkRes.AddFileName(s);
  335. if librarysearchpath.FindFile('crti.o',s) then
  336. LinkRes.AddFileName(s);
  337. end;
  338. { main objectfiles }
  339. while not ObjectFiles.Empty do
  340. begin
  341. s:=ObjectFiles.GetFirst;
  342. if s<>'' then
  343. LinkRes.AddFileName(maybequoted(s));
  344. end;
  345. LinkRes.Add(')');
  346. { Write staticlibraries }
  347. if not StaticLibFiles.Empty then
  348. begin
  349. LinkRes.Add('GROUP(');
  350. While not StaticLibFiles.Empty do
  351. begin
  352. S:=StaticLibFiles.GetFirst;
  353. LinkRes.AddFileName(maybequoted(s))
  354. end;
  355. LinkRes.Add(')');
  356. end;
  357. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  358. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  359. if not SharedLibFiles.Empty then
  360. begin
  361. LinkRes.Add('INPUT(');
  362. While not SharedLibFiles.Empty do
  363. begin
  364. S:=SharedLibFiles.GetFirst;
  365. if s<>'c' then
  366. begin
  367. i:=Pos(target_info.sharedlibext,S);
  368. if i>0 then
  369. Delete(S,i,255);
  370. LinkRes.Add('-l'+s);
  371. end
  372. else
  373. begin
  374. linklibc:=true;
  375. end;
  376. end;
  377. { be sure that libc is the last lib }
  378. if linklibc then
  379. LinkRes.Add('-lc');
  380. { when we have -static for the linker the we also need libgcc }
  381. if (cs_link_staticflag in aktglobalswitches) then
  382. LinkRes.Add('-lgcc');
  383. LinkRes.Add(')');
  384. end;
  385. { objects which must be at the end }
  386. if linklibc and (libctype<>uclibc) then
  387. begin
  388. found1:=librarysearchpath.FindFile('crtend.o',s1);
  389. found2:=librarysearchpath.FindFile('crtn.o',s2);
  390. if found1 or found2 then
  391. begin
  392. LinkRes.Add('INPUT(');
  393. if found1 then
  394. LinkRes.AddFileName(s1);
  395. if found2 then
  396. LinkRes.AddFileName(s2);
  397. LinkRes.Add(')');
  398. end;
  399. end;
  400. { Write and Close response }
  401. linkres.writetodisk;
  402. linkres.Free;
  403. WriteResponseFile:=True;
  404. end;
  405. function contains_exports : boolean;
  406. var
  407. hp : tused_unit;
  408. begin
  409. result:=((current_module.flags and uf_has_exports)=uf_has_exports);
  410. if not result then
  411. begin
  412. hp:=tused_unit(usedunits.first);
  413. While Assigned(hp) and not result do
  414. begin
  415. result:=((hp.u.flags and uf_has_exports)=uf_has_exports);
  416. hp:=tused_unit(hp.next);
  417. end;
  418. end;
  419. end;
  420. function TLinkerLinux.MakeExecutable:boolean;
  421. var
  422. binstr : String;
  423. cmdstr : TCmdStr;
  424. success : boolean;
  425. DynLinkStr : string[60];
  426. GCSectionsStr,
  427. StaticStr,
  428. StripStr : string[40];
  429. begin
  430. if not(cs_link_extern in aktglobalswitches) then
  431. Message1(exec_i_linking,current_module.exefilename^);
  432. { Create some replacements }
  433. StaticStr:='';
  434. StripStr:='';
  435. GCSectionsStr:='';
  436. DynLinkStr:='';
  437. if (cs_link_staticflag in aktglobalswitches) then
  438. StaticStr:='-static';
  439. if (cs_link_strip in aktglobalswitches) then
  440. StripStr:='-s';
  441. if (cs_link_smart in aktglobalswitches) and
  442. (tf_smartlink_sections in target_info.flags) then
  443. GCSectionsStr:='--gc-sections';
  444. If (cs_profile in aktmoduleswitches) or
  445. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  446. begin
  447. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  448. if cshared Then
  449. DynLinkStr:='--shared ' + DynLinkStr;
  450. if rlinkpath<>'' Then
  451. DynLinkStr:='--rpath-link '+rlinkpath + ' '+ DynLinkStr;
  452. End;
  453. { Write used files and libraries }
  454. WriteResponseFile(false);
  455. { Call linker }
  456. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  457. Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
  458. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  459. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  460. Replace(cmdstr,'$STATIC',StaticStr);
  461. Replace(cmdstr,'$STRIP',StripStr);
  462. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  463. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  464. { create dynamic symbol table? }
  465. if contains_exports then
  466. cmdstr:=cmdstr+' -E';
  467. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,false);
  468. { Remove ReponseFile }
  469. if (success) and not(cs_link_extern in aktglobalswitches) then
  470. RemoveFile(outputexedir+Info.ResName);
  471. if (success) then
  472. success:=PostProcessExecutable(current_module.exefilename^,false);
  473. MakeExecutable:=success; { otherwise a recursive call to link method }
  474. end;
  475. Function TLinkerLinux.MakeSharedLibrary:boolean;
  476. var
  477. InitStr,
  478. FiniStr,
  479. SoNameStr : string[80];
  480. binstr : String;
  481. cmdstr : TCmdStr;
  482. success : boolean;
  483. begin
  484. MakeSharedLibrary:=false;
  485. if not(cs_link_extern in aktglobalswitches) then
  486. Message1(exec_i_linking,current_module.sharedlibfilename^);
  487. { Write used files and libraries }
  488. WriteResponseFile(true);
  489. { Create some replacements }
  490. InitStr:='-init FPC_LIB_START';
  491. FiniStr:='-fini FPC_LIB_EXIT';
  492. SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
  493. { Call linker }
  494. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  495. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  496. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  497. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  498. Replace(cmdstr,'$INIT',InitStr);
  499. Replace(cmdstr,'$FINI',FiniStr);
  500. Replace(cmdstr,'$SONAME',SoNameStr);
  501. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  502. { Strip the library ? }
  503. if success and (cs_link_strip in aktglobalswitches) then
  504. begin
  505. { only remove non global symbols and debugging info for a library }
  506. Info.DllCmd[2]:='strip --discard-all --strip-debug $EXE';
  507. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  508. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  509. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  510. end;
  511. { Remove ReponseFile }
  512. if (success) and not(cs_link_extern in aktglobalswitches) then
  513. RemoveFile(outputexedir+Info.ResName);
  514. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  515. end;
  516. function tlinkerLinux.postprocessexecutable(const fn : string;isdll:boolean):boolean;
  517. Var
  518. cmdstr: string;
  519. found : boolean;
  520. hp : tused_unit;
  521. begin
  522. postprocessexecutable:=True;
  523. if target_res.id=res_elf then
  524. begin
  525. found:=((current_module.flags and uf_has_resourcefiles)=uf_has_resourcefiles);
  526. if not found then
  527. begin
  528. hp:=tused_unit(usedunits.first);
  529. While Assigned(hp) and not Found do
  530. begin
  531. Found:=((hp.u.flags and uf_has_resourcefiles)=uf_has_resourcefiles);
  532. hp:=tused_unit(hp.next);
  533. end;
  534. end;
  535. if found then
  536. begin
  537. cmdstr:=' -f -i '+maybequoted(fn);
  538. postprocessexecutable:=DoExec(FindUtil(utilsprefix+'fpcres'),cmdstr,false,false);
  539. end;
  540. end;
  541. end;
  542. {*****************************************************************************
  543. Initialize
  544. *****************************************************************************}
  545. initialization
  546. {$ifdef i386}
  547. RegisterExternalLinker(system_i386_linux_info,TLinkerLinux);
  548. RegisterImport(system_i386_linux,timportliblinux);
  549. RegisterExport(system_i386_linux,texportliblinux);
  550. RegisterTarget(system_i386_linux_info);
  551. RegisterRes(res_elf32_info);
  552. RegisterExternalLinker(system_x86_6432_linux_info,TLinkerLinux);
  553. RegisterImport(system_x86_6432_linux,timportliblinux);
  554. RegisterExport(system_x86_6432_linux,texportliblinux);
  555. RegisterTarget(system_x86_6432_linux_info);
  556. {$endif i386}
  557. {$ifdef m68k}
  558. RegisterExternalLinker(system_m68k_linux_info,TLinkerLinux);
  559. RegisterImport(system_m68k_linux,timportliblinux);
  560. RegisterExport(system_m68k_linux,texportliblinux);
  561. RegisterTarget(system_m68k_linux_info);
  562. {$endif m68k}
  563. {$ifdef powerpc}
  564. RegisterExternalLinker(system_powerpc_linux_info,TLinkerLinux);
  565. RegisterImport(system_powerpc_linux,timportliblinux);
  566. RegisterExport(system_powerpc_linux,texportliblinux);
  567. RegisterTarget(system_powerpc_linux_info);
  568. {$endif powerpc}
  569. {$ifdef alpha}
  570. RegisterExternalLinker(system_alpha_linux_info,TLinkerLinux);
  571. RegisterImport(system_alpha_linux,timportliblinux);
  572. RegisterExport(system_alpha_linux,texportliblinux);
  573. RegisterTarget(system_alpha_linux_info);
  574. {$endif alpha}
  575. {$ifdef x86_64}
  576. RegisterExternalLinker(system_x86_64_linux_info,TLinkerLinux);
  577. RegisterImport(system_x86_64_linux,timportliblinux);
  578. RegisterExport(system_x86_64_linux,texportliblinux);
  579. RegisterTarget(system_x86_64_linux_info);
  580. RegisterRes(res_elf64_info);
  581. {$endif x86_64}
  582. {$ifdef SPARC}
  583. RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux);
  584. RegisterImport(system_SPARC_linux,timportliblinux);
  585. RegisterExport(system_SPARC_linux,texportliblinux);
  586. RegisterTarget(system_SPARC_linux_info);
  587. {$endif SPARC}
  588. {$ifdef ARM}
  589. RegisterExternalLinker(system_arm_linux_info,TLinkerLinux);
  590. RegisterImport(system_arm_linux,timportliblinux);
  591. RegisterExport(system_arm_linux,texportliblinux);
  592. RegisterTarget(system_arm_linux_info);
  593. {$endif ARM}
  594. end.