t_bsd.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. {
  2. Copyright (c) 1998-2002 by Peter Vreman (original Linux)
  3. (c) 2000 by Marco van de Voort (FreeBSD mods)
  4. This unit implements support import,export,link routines
  5. for the (i386)FreeBSD target
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 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 t_bsd;
  20. {$i fpcdefs.inc}
  21. interface
  22. implementation
  23. uses
  24. sysutils,
  25. cutils,cfileutils,cclasses,
  26. verbose,systems,globtype,globals,
  27. symconst,script,
  28. fmodule,aasmbase,aasmtai,aasmdata,aasmcpu,cpubase,symsym,symdef,
  29. import,export,link,i_bsd,
  30. cgutils,cgbase,cgobj,cpuinfo,ogbase;
  31. type
  32. timportlibdarwin=class(timportlib)
  33. procedure generatelib;override;
  34. end;
  35. timportlibbsd=class(timportlib)
  36. procedure generatelib;override;
  37. end;
  38. texportlibbsd=class(texportlib)
  39. procedure preparelib(const s : string);override;
  40. procedure exportprocedure(hp : texported_item);override;
  41. procedure exportvar(hp : texported_item);override;
  42. procedure generatelib;override;
  43. end;
  44. tlinkerbsd=class(texternallinker)
  45. private
  46. LdSupportsNoResponseFile : boolean;
  47. LibrarySuffix : Char;
  48. Function WriteResponseFile(isdll:boolean) : Boolean;
  49. public
  50. constructor Create;override;
  51. procedure SetDefaultInfo;override;
  52. function MakeExecutable:boolean;override;
  53. function MakeSharedLibrary:boolean;override;
  54. procedure LoadPredefinedLibraryOrder; override;
  55. end;
  56. {*****************************************************************************
  57. TIMPORTLIBDARWIN
  58. *****************************************************************************}
  59. procedure timportlibdarwin.generatelib;
  60. begin
  61. end;
  62. {*****************************************************************************
  63. TIMPORTLIBBSD
  64. *****************************************************************************}
  65. procedure timportlibbsd.generatelib;
  66. var
  67. i : longint;
  68. ImportLibrary : TImportLibrary;
  69. begin
  70. for i:=0 to current_module.ImportLibraryList.Count-1 do
  71. begin
  72. ImportLibrary:=TImportLibrary(current_module.ImportLibraryList[i]);
  73. current_module.linkothersharedlibs.add(ImportLibrary.Name,link_always);
  74. end;
  75. end;
  76. {*****************************************************************************
  77. TEXPORTLIBBSD
  78. *****************************************************************************}
  79. procedure texportlibbsd.preparelib(const s:string);
  80. begin
  81. end;
  82. procedure texportlibbsd.exportprocedure(hp : texported_item);
  83. var
  84. hp2 : texported_item;
  85. begin
  86. { first test the index value }
  87. if (hp.options and eo_index)<>0 then
  88. begin
  89. Message1(parser_e_no_export_with_index_for_target,'*bsd/darwin');
  90. exit;
  91. end;
  92. { now place in correct order }
  93. hp2:=texported_item(current_module._exports.first);
  94. while assigned(hp2) and
  95. (hp.name^>hp2.name^) do
  96. hp2:=texported_item(hp2.next);
  97. { insert hp there !! }
  98. if assigned(hp2) and (hp2.name^=hp.name^) then
  99. begin
  100. { this is not allowed !! }
  101. Message1(parser_e_export_name_double,hp.name^);
  102. exit;
  103. end;
  104. if hp2=texported_item(current_module._exports.first) then
  105. current_module._exports.concat(hp)
  106. else if assigned(hp2) then
  107. begin
  108. hp.next:=hp2;
  109. hp.previous:=hp2.previous;
  110. if assigned(hp2.previous) then
  111. hp2.previous.next:=hp;
  112. hp2.previous:=hp;
  113. end
  114. else
  115. current_module._exports.concat(hp);
  116. end;
  117. procedure texportlibbsd.exportvar(hp : texported_item);
  118. begin
  119. hp.is_var:=true;
  120. exportprocedure(hp);
  121. end;
  122. procedure texportlibbsd.generatelib; // straight t_linux copy for now.
  123. var
  124. hp2 : texported_item;
  125. {$ifdef x86}
  126. sym : tasmsymbol;
  127. r : treference;
  128. {$endif x86}
  129. begin
  130. new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
  131. hp2:=texported_item(current_module._exports.first);
  132. while assigned(hp2) do
  133. begin
  134. if (not hp2.is_var) and
  135. (hp2.sym.typ=procsym) then
  136. begin
  137. { the manglednames can already be the same when the procedure
  138. is declared with cdecl }
  139. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  140. begin
  141. { place jump in al_procedures }
  142. current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign));
  143. current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  144. if (cs_create_pic in current_settings.moduleswitches) and
  145. { other targets need to be checked how it works }
  146. (target_info.system in [system_i386_freebsd]) then
  147. begin
  148. {$ifdef x86}
  149. sym:=current_asmdata.RefAsmSymbol(tprocsym(hp2.sym).first_procdef.mangledname);
  150. reference_reset_symbol(r,sym,0);
  151. if cs_create_pic in current_settings.moduleswitches then
  152. r.refaddr:=addr_pic
  153. else
  154. r.refaddr:=addr_full;
  155. current_asmdata.asmlists[al_procedures].concat(taicpu.op_ref(A_JMP,S_NO,r));
  156. {$endif x86}
  157. end
  158. else
  159. cg.a_jmp_name(current_asmdata.asmlists[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname);
  160. current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
  161. end;
  162. end
  163. else
  164. Message1(parser_e_no_export_of_variables_for_target,'*bsd/darwin');
  165. hp2:=texported_item(hp2.next);
  166. end;
  167. end;
  168. {*****************************************************************************
  169. TLINKERBSD
  170. *****************************************************************************}
  171. Constructor TLinkerBSD.Create;
  172. begin
  173. Inherited Create;
  174. if not Dontlinkstdlibpath Then
  175. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  176. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true)
  177. else
  178. { Mac OS X doesn't have a /lib }
  179. LibrarySearchPath.AddPath('/usr/lib',true)
  180. end;
  181. procedure TLinkerBSD.SetDefaultInfo;
  182. {
  183. This will also detect which libc version will be used
  184. }
  185. begin
  186. LibrarySuffix:=' ';
  187. LdSupportsNoResponseFile := (target_info.system in [system_m68k_netbsd,system_powerpc_darwin,system_i386_darwin]);
  188. with Info do
  189. begin
  190. if LdSupportsNoResponseFile then
  191. begin
  192. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  193. begin
  194. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE `cat $RES`';
  195. DllCmd[1]:='ld $OPT -shared -L. -o $EXE `cat $RES`'
  196. end
  197. else
  198. begin
  199. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
  200. DllCmd[1]:='libtool $OPT -dynamic -multiply_defined suppress -L. -o $EXE `cat $RES`'
  201. end
  202. end
  203. else
  204. begin
  205. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
  206. DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
  207. end;
  208. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  209. DllCmd[2]:='strip --strip-unneeded $EXE'
  210. else
  211. DllCmd[2]:='strip -x $EXE';
  212. DynamicLinker:='';
  213. end;
  214. end;
  215. procedure TLinkerBSD.LoadPredefinedLibraryOrder;
  216. // put your linkorder/linkalias overrides here.
  217. // Note: assumes only called when reordering/aliasing is used.
  218. Begin
  219. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  220. begin
  221. if (target_info.system =system_i386_freebsd) and
  222. not (cs_link_no_default_lib_order in current_settings.globalswitches) Then
  223. Begin
  224. LinkLibraryOrder.add('gcc','',15);
  225. LinkLibraryOrder.add('c','',50); // c and c_p mutual. excl?
  226. LinkLibraryOrder.add('c_p','',55);
  227. LinkLibraryOrder.add('pthread','',75); // pthread and c_r should be mutually exclusive
  228. LinkLibraryOrder.add('c_r','',76);
  229. LinkLibraryOrder.add('kvm','',80); // must be before ncurses
  230. if (cs_link_pthread in current_settings.globalswitches) Then // convert libpthread to libc_r.
  231. LinkLibraryAliases.add('pthread','c_r');
  232. end;
  233. end
  234. else
  235. begin
  236. LinkLibraryOrder.add('gcc','',15);
  237. LinkLibraryOrder.add('c','',50);
  238. end;
  239. End;
  240. Function TLinkerBSD.WriteResponseFile(isdll:boolean) : Boolean;
  241. Var
  242. linkres : TLinkRes;
  243. i : longint;
  244. cprtobj,
  245. gprtobj,
  246. prtobj : string[80];
  247. HPath : TStringListItem;
  248. s,s1,s2 : string;
  249. linkdynamic,
  250. linklibc : boolean;
  251. Fl1,Fl2 : Boolean;
  252. IsDarwin : Boolean;
  253. ReOrder : Boolean;
  254. begin
  255. WriteResponseFile:=False;
  256. ReOrder:=False;
  257. IsDarwin:=target_info.system in [system_powerpc_darwin,system_i386_darwin];
  258. { set special options for some targets }
  259. if not IsDarwin Then
  260. begin
  261. prtobj:='prt0';
  262. cprtobj:='cprt0';
  263. gprtobj:='gprt0';
  264. linkdynamic:=not(SharedLibFiles.empty);
  265. linklibc:=(SharedLibFiles.Find('c')<>nil);
  266. // this one is a bit complex.
  267. // Only reorder for now if -XL or -XO params are given
  268. // or when -Xf.
  269. reorder:= linklibc and
  270. (
  271. ReorderEntries
  272. or
  273. (cs_link_pthread in current_settings.globalswitches));
  274. if cs_profile in current_settings.moduleswitches then
  275. begin
  276. prtobj:=gprtobj;
  277. AddSharedLibrary('c');
  278. LibrarySuffix:='p';
  279. linklibc:=true;
  280. end
  281. else
  282. begin
  283. if linklibc then
  284. prtobj:=cprtobj;
  285. end;
  286. // after this point addition of shared libs not allowed.
  287. end
  288. else
  289. begin
  290. { for darwin: always link dynamically against libc }
  291. linklibc := true;
  292. reorder:=reorderentries;
  293. if not(isdll) then
  294. if not(cs_profile in current_settings.moduleswitches) then
  295. begin
  296. if librarysearchpath.FindFile('crt1.o',s) then
  297. prtobj:=s
  298. else
  299. prtobj:='/usr/lib/crt1.o';
  300. end
  301. else
  302. prtobj:='/usr/lib/gcrt1.o'
  303. else
  304. prtobj:='';
  305. end;
  306. if reorder Then
  307. ExpandAndApplyOrder(SharedLibFiles);
  308. { Open link.res file }
  309. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
  310. if (not isdll) then
  311. begin
  312. case target_info.system of
  313. system_powerpc_darwin:
  314. LinkRes.Add('-arch ppc');
  315. system_i386_darwin:
  316. LinkRes.Add('-arch i386');
  317. end;
  318. end;
  319. { Write path to search libraries }
  320. HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
  321. while assigned(HPath) do
  322. begin
  323. if LdSupportsNoResponseFile then
  324. LinkRes.Add(maybequoted('-L'+HPath.Str))
  325. else
  326. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  327. HPath:=TStringListItem(HPath.Next);
  328. end;
  329. HPath:=TStringListItem(LibrarySearchPath.First);
  330. while assigned(HPath) do
  331. begin
  332. if LdSupportsNoResponseFile then
  333. LinkRes.Add(maybequoted('-L'+HPath.Str))
  334. else
  335. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  336. HPath:=TStringListItem(HPath.Next);
  337. end;
  338. if not LdSupportsNoResponseFile then
  339. LinkRes.Add('INPUT(');
  340. { add objectfiles, start with prt0 always }
  341. if prtobj<>'' then
  342. LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
  343. { try to add crti and crtbegin if linking to C }
  344. if linklibc and
  345. not IsDarwin Then
  346. begin
  347. if librarysearchpath.FindFile('crtbegin.o',s) then
  348. LinkRes.AddFileName(s);
  349. if librarysearchpath.FindFile('crti.o',s) then
  350. LinkRes.AddFileName(s);
  351. end;
  352. { main objectfiles }
  353. while not ObjectFiles.Empty do
  354. begin
  355. s:=ObjectFiles.GetFirst;
  356. if s<>'' then
  357. LinkRes.AddFileName(maybequoted(s));
  358. end;
  359. if not LdSupportsNoResponseFile then
  360. LinkRes.Add(')');
  361. { Write staticlibraries }
  362. if not StaticLibFiles.Empty then
  363. begin
  364. if not LdSupportsNoResponseFile then
  365. LinkRes.Add('GROUP(');
  366. While not StaticLibFiles.Empty do
  367. begin
  368. S:=StaticLibFiles.GetFirst;
  369. LinkRes.AddFileName(maybequoted(s))
  370. end;
  371. if not LdSupportsNoResponseFile then
  372. LinkRes.Add(')');
  373. end;
  374. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  375. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  376. if not SharedLibFiles.Empty then
  377. begin
  378. if not LdSupportsNoResponseFile then
  379. LinkRes.Add('INPUT(');
  380. While not SharedLibFiles.Empty do
  381. begin
  382. S:=SharedLibFiles.GetFirst;
  383. if (s<>'c') or reorder then
  384. begin
  385. i:=Pos(target_info.sharedlibext,S);
  386. if i>0 then
  387. Delete(S,i,255);
  388. LinkRes.Add('-l'+s);
  389. end
  390. else
  391. begin
  392. linklibc:=true;
  393. linkdynamic:=false; { libc will include the ld-* for us }
  394. end;
  395. end;
  396. { be sure that libc is the last lib }
  397. if linklibc and not reorder then
  398. Begin
  399. If LibrarySuffix=' ' Then
  400. LinkRes.Add('-lc')
  401. else
  402. LinkRes.Add('-lc_'+LibrarySuffix);
  403. If LibrarySuffix='r' Then
  404. LinkRes.Add('-lc');
  405. end;
  406. { when we have -static for the linker the we also need libgcc }
  407. if (cs_link_staticflag in current_settings.globalswitches) then
  408. LinkRes.Add('-lgcc');
  409. if linkdynamic and (Info.DynamicLinker<>'') then
  410. LinkRes.AddFileName(Info.DynamicLinker);
  411. if not LdSupportsNoResponseFile then
  412. LinkRes.Add(')');
  413. end;
  414. { objects which must be at the end }
  415. if linklibc and
  416. not IsDarwin Then
  417. begin
  418. Fl1:=librarysearchpath.FindFile('crtend.o',s1);
  419. Fl2:=librarysearchpath.FindFile('crtn.o',s2);
  420. if Fl1 or Fl2 then
  421. begin
  422. LinkRes.Add('INPUT(');
  423. If Fl1 Then
  424. LinkRes.AddFileName(s1);
  425. If Fl2 Then
  426. LinkRes.AddFileName(s2);
  427. LinkRes.Add(')');
  428. end;
  429. end;
  430. { ignore the fact that our relocations are in non-writable sections, }
  431. { will be fixed once we have pic support }
  432. if isdll and IsDarwin Then
  433. LinkRes.Add('-read_only_relocs suppress');
  434. { Write and Close response }
  435. linkres.writetodisk;
  436. linkres.Free;
  437. WriteResponseFile:=True;
  438. end;
  439. function TLinkerBSD.MakeExecutable:boolean;
  440. var
  441. binstr : String;
  442. cmdstr : TCmdStr;
  443. success : boolean;
  444. DynLinkStr : string[60];
  445. GCSectionsStr,
  446. StaticStr,
  447. StripStr : string[40];
  448. begin
  449. if not(cs_link_nolink in current_settings.globalswitches) then
  450. Message1(exec_i_linking,current_module.exefilename^);
  451. { Create some replacements }
  452. StaticStr:='';
  453. StripStr:='';
  454. DynLinkStr:='';
  455. GCSectionsStr:='';
  456. if (cs_link_staticflag in current_settings.globalswitches) then
  457. begin
  458. if (target_info.system=system_m68k_netbsd) and
  459. ((cs_link_on_target in current_settings.globalswitches) or
  460. (target_info.system=source_info.system)) then
  461. StaticStr:='-Bstatic'
  462. else
  463. StaticStr:='-static';
  464. end;
  465. if (cs_link_strip in current_settings.globalswitches) then
  466. StripStr:='-s';
  467. if (cs_link_smart in current_settings.globalswitches) and
  468. (tf_smartlink_sections in target_info.flags) then
  469. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  470. GCSectionsStr:='--gc-sections'
  471. else
  472. // warning: this option only exists for 32 bit under Mac OS X, maybe the default for 64 bit?
  473. GCSectionsStr:='-dead_strip';
  474. If (cs_profile in current_settings.moduleswitches) or
  475. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  476. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  477. if CShared Then
  478. begin
  479. if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
  480. DynLinKStr:=DynLinkStr+' --shared'
  481. else
  482. DynLinKStr:=DynLinkStr+' -dynamic'; // one dash!
  483. end;
  484. { Write used files and libraries }
  485. WriteResponseFile(false);
  486. { Call linker }
  487. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  488. Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
  489. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  490. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  491. Replace(cmdstr,'$STATIC',StaticStr);
  492. Replace(cmdstr,'$STRIP',StripStr);
  493. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  494. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  495. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile);
  496. { Remove ReponseFile }
  497. if (success) and not(cs_link_nolink in current_settings.globalswitches) then
  498. RemoveFile(outputexedir+Info.ResName);
  499. MakeExecutable:=success; { otherwise a recursive call to link method }
  500. end;
  501. Function TLinkerBSD.MakeSharedLibrary:boolean;
  502. var
  503. InitStr,
  504. FiniStr,
  505. SoNameStr : string[80];
  506. binstr : String;
  507. cmdstr : TCmdStr;
  508. success : boolean;
  509. begin
  510. MakeSharedLibrary:=false;
  511. if not(cs_link_nolink in current_settings.globalswitches) then
  512. Message1(exec_i_linking,current_module.sharedlibfilename^);
  513. { Write used files and libraries }
  514. WriteResponseFile(true);
  515. InitStr:='-init FPC_LIB_START';
  516. FiniStr:='-fini FPC_LIB_EXIT';
  517. SoNameStr:='-soname '+ExtractFileName(current_module.sharedlibfilename^);
  518. { Call linker }
  519. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  520. {$ifndef darwin}
  521. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  522. {$else darwin}
  523. Replace(cmdstr,'$EXE',maybequoted(ExpandFileName(current_module.sharedlibfilename^)));
  524. {$endif darwin}
  525. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  526. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  527. Replace(cmdstr,'$INIT',InitStr);
  528. Replace(cmdstr,'$FINI',FiniStr);
  529. Replace(cmdstr,'$SONAME',SoNameStr);
  530. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,LdSupportsNoResponseFile);
  531. { Strip the library ? }
  532. if success and (cs_link_strip in current_settings.globalswitches) then
  533. begin
  534. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  535. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  536. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  537. end;
  538. { Remove ReponseFile }
  539. if (success) and not(cs_link_nolink in current_settings.globalswitches) then
  540. RemoveFile(outputexedir+Info.ResName);
  541. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  542. end;
  543. {*****************************************************************************
  544. Initialize
  545. *****************************************************************************}
  546. initialization
  547. {$ifdef x86_64}
  548. RegisterExternalLinker(system_x86_64_FreeBSD_info,TLinkerBSD);
  549. RegisterImport(system_x86_64_freebsd,timportlibbsd);
  550. RegisterExport(system_x86_64_freebsd,texportlibbsd);
  551. RegisterTarget(system_x86_64_freebsd_info);
  552. {$endif}
  553. {$ifdef i386}
  554. RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD);
  555. RegisterExternalLinker(system_i386_NetBSD_info,TLinkerBSD);
  556. RegisterExternalLinker(system_i386_OpenBSD_info,TLinkerBSD);
  557. RegisterImport(system_i386_freebsd,timportlibbsd);
  558. RegisterExport(system_i386_freebsd,texportlibbsd);
  559. RegisterTarget(system_i386_freebsd_info);
  560. RegisterImport(system_i386_netbsd,timportlibbsd);
  561. RegisterExport(system_i386_netbsd,texportlibbsd);
  562. RegisterTarget(system_i386_netbsd_info);
  563. RegisterImport(system_i386_openbsd,timportlibbsd);
  564. RegisterExport(system_i386_openbsd,texportlibbsd);
  565. RegisterTarget(system_i386_openbsd_info);
  566. RegisterExternalLinker(system_i386_darwin_info,TLinkerBSD);
  567. RegisterImport(system_i386_darwin,timportlibdarwin);
  568. RegisterExport(system_i386_darwin,texportlibbsd);
  569. RegisterTarget(system_i386_darwin_info);
  570. {$endif i386}
  571. {$ifdef m68k}
  572. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  573. RegisterExternalLinker(system_m68k_NetBSD_info,TLinkerBSD);
  574. RegisterImport(system_m68k_netbsd,timportlibbsd);
  575. RegisterExport(system_m68k_netbsd,texportlibbsd);
  576. RegisterTarget(system_m68k_netbsd_info);
  577. {$endif m68k}
  578. {$ifdef powerpc}
  579. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  580. RegisterExternalLinker(system_powerpc_darwin_info,TLinkerBSD);
  581. RegisterImport(system_powerpc_darwin,timportlibdarwin);
  582. RegisterExport(system_powerpc_darwin,texportlibbsd);
  583. RegisterTarget(system_powerpc_darwin_info);
  584. RegisterExternalLinker(system_powerpc_netbsd_info,TLinkerBSD);
  585. RegisterImport(system_powerpc_netbsd,timportlibbsd);
  586. RegisterExport(system_powerpc_netbsd,texportlibbsd);
  587. RegisterTarget(system_powerpc_netbsd_info);
  588. {$endif powerpc}
  589. end.