t_bsd.pas 20 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. cutils,cclasses,
  25. verbose,systems,globtype,globals,
  26. symconst,script,
  27. fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef,
  28. import,export,link,i_bsd,
  29. cgutils,cgbase,cgobj,cpuinfo;
  30. type
  31. tdarwinimported_item = class(timported_item)
  32. procdef : tprocdef;
  33. end;
  34. timportlibdarwin=class(timportlib)
  35. procedure preparelib(const s:string);override;
  36. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  37. procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
  38. procedure generatelib;override;
  39. procedure generatesmartlib;override;
  40. end;
  41. timportlibbsd=class(timportlib)
  42. procedure preparelib(const s:string);override;
  43. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  44. procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
  45. procedure generatelib;override;
  46. end;
  47. texportlibbsd=class(texportlib)
  48. procedure preparelib(const s : string);override;
  49. procedure exportprocedure(hp : texported_item);override;
  50. procedure exportvar(hp : texported_item);override;
  51. procedure generatelib;override;
  52. end;
  53. tlinkerbsd=class(texternallinker)
  54. private
  55. LdSupportsNoResponseFile : boolean;
  56. LibrarySuffix : Char;
  57. Function WriteResponseFile(isdll:boolean) : Boolean;
  58. public
  59. constructor Create;override;
  60. procedure SetDefaultInfo;override;
  61. function MakeExecutable:boolean;override;
  62. function MakeSharedLibrary:boolean;override;
  63. end;
  64. {*****************************************************************************
  65. TIMPORTLIBDARWIN
  66. *****************************************************************************}
  67. procedure timportlibdarwin.preparelib(const s : string);
  68. begin
  69. if asmlist[al_imports]=nil then
  70. asmlist[al_imports]:=TAAsmoutput.create;
  71. end;
  72. procedure timportlibdarwin.importprocedure(aprocdef:tprocdef;const module : string;index : longint;const name : string);
  73. begin
  74. { insert sharedlibrary }
  75. { current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
  76. end;
  77. procedure timportlibdarwin.importvariable(vs:tglobalvarsym;const name,module:string);
  78. begin
  79. { insert sharedlibrary }
  80. { current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
  81. { the rest is handled in the nppcld.pas tppcloadnode }
  82. vs.set_mangledname(name);
  83. end;
  84. procedure timportlibdarwin.generatesmartlib;
  85. begin
  86. generatelib;
  87. end;
  88. procedure timportlibdarwin.generatelib;
  89. begin
  90. end;
  91. {*****************************************************************************
  92. TIMPORTLIBBSD
  93. *****************************************************************************}
  94. procedure timportlibbsd.preparelib(const s : string);
  95. begin
  96. end;
  97. procedure timportlibbsd.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
  98. begin
  99. { insert sharedlibrary }
  100. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  101. end;
  102. procedure timportlibbsd.importvariable(vs:tglobalvarsym;const name,module:string);
  103. begin
  104. { insert sharedlibrary }
  105. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  106. { reset the mangledname and turn off the dll_var option }
  107. vs.set_mangledname(name);
  108. exclude(vs.varoptions,vo_is_dll_var);
  109. end;
  110. procedure timportlibbsd.generatelib;
  111. begin
  112. end;
  113. {*****************************************************************************
  114. TEXPORTLIBBSD
  115. *****************************************************************************}
  116. procedure texportlibbsd.preparelib(const s:string);
  117. begin
  118. end;
  119. procedure texportlibbsd.exportprocedure(hp : texported_item);
  120. var
  121. hp2 : texported_item;
  122. begin
  123. { first test the index value }
  124. if (hp.options and eo_index)<>0 then
  125. begin
  126. Message1(parser_e_no_export_with_index_for_target,'*bsd/darwin');
  127. exit;
  128. end;
  129. { now place in correct order }
  130. hp2:=texported_item(current_module._exports.first);
  131. while assigned(hp2) and
  132. (hp.name^>hp2.name^) do
  133. hp2:=texported_item(hp2.next);
  134. { insert hp there !! }
  135. if assigned(hp2) and (hp2.name^=hp.name^) then
  136. begin
  137. { this is not allowed !! }
  138. Message1(parser_e_export_name_double,hp.name^);
  139. exit;
  140. end;
  141. if hp2=texported_item(current_module._exports.first) then
  142. current_module._exports.concat(hp)
  143. else if assigned(hp2) then
  144. begin
  145. hp.next:=hp2;
  146. hp.previous:=hp2.previous;
  147. if assigned(hp2.previous) then
  148. hp2.previous.next:=hp;
  149. hp2.previous:=hp;
  150. end
  151. else
  152. current_module._exports.concat(hp);
  153. end;
  154. procedure texportlibbsd.exportvar(hp : texported_item);
  155. begin
  156. hp.is_var:=true;
  157. exportprocedure(hp);
  158. end;
  159. procedure texportlibbsd.generatelib;
  160. var
  161. hp2 : texported_item;
  162. begin
  163. hp2:=texported_item(current_module._exports.first);
  164. while assigned(hp2) do
  165. begin
  166. if (not hp2.is_var) and
  167. (hp2.sym.typ=procsym) then
  168. begin
  169. { the manglednames can already be the same when the procedure
  170. is declared with cdecl }
  171. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  172. begin
  173. {$ifdef i386}
  174. { place jump in al_procedures }
  175. asmlist[al_procedures].concat(Tai_align.Create_op(4,$90));
  176. asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  177. asmlist[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  178. asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
  179. {$endif i386}
  180. {$ifdef powerpc}
  181. asmlist[al_procedures].concat(Tai_align.create(16));
  182. asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  183. asmlist[al_procedures].concat(Taicpu.Op_sym(A_B,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  184. asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
  185. {$endif powerpc}
  186. end;
  187. end
  188. else
  189. Message1(parser_e_no_export_of_variables_for_target,'*bsd/darwin');
  190. hp2:=texported_item(hp2.next);
  191. end;
  192. end;
  193. {*****************************************************************************
  194. TLINKERLINUX
  195. *****************************************************************************}
  196. Constructor TLinkerBSD.Create;
  197. begin
  198. Inherited Create;
  199. if not Dontlinkstdlibpath Then
  200. if (target_info.system <> system_powerpc_darwin) then
  201. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true)
  202. else
  203. { Mac OS X doesn't have a /lib }
  204. LibrarySearchPath.AddPath('/usr/lib',true)
  205. end;
  206. procedure TLinkerBSD.SetDefaultInfo;
  207. {
  208. This will also detect which libc version will be used
  209. }
  210. begin
  211. LibrarySuffix:=' ';
  212. LdSupportsNoResponseFile := (target_info.system in [system_m68k_netbsd,system_powerpc_darwin]);
  213. with Info do
  214. begin
  215. if LdSupportsNoResponseFile then
  216. begin
  217. if (target_info.system <> system_powerpc_darwin) then
  218. begin
  219. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE `cat $RES`';
  220. DllCmd[1]:='ld $OPT -shared -L. -o $EXE `cat $RES`'
  221. end
  222. else
  223. begin
  224. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
  225. DllCmd[1]:='libtool $OPT -dynamic -init PASCALMAIN -multiply_defined suppress -L. -o $EXE `cat $RES`'
  226. end
  227. end
  228. else
  229. begin
  230. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
  231. DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
  232. end;
  233. if (target_info.system <> system_powerpc_darwin) then
  234. DllCmd[2]:='strip --strip-unneeded $EXE'
  235. else
  236. DllCmd[2]:='strip -x $EXE';
  237. { first try glibc2 }
  238. {$ifdef GLIBC2} {Keep linux code in place. FBSD might go to a different
  239. glibc too once}
  240. DynamicLinker:='/lib/ld-linux.so.2';
  241. if FileExists(DynamicLinker) then
  242. begin
  243. Glibc2:=true;
  244. { Check for 2.0 files, else use the glibc 2.1 stub }
  245. if FileExists('/lib/ld-2.0.*') then
  246. Glibc21:=false
  247. else
  248. Glibc21:=true;
  249. end
  250. else
  251. DynamicLinker:='/lib/ld-linux.so.1';
  252. {$else}
  253. DynamicLinker:='';
  254. {$endif}
  255. end;
  256. end;
  257. Function TLinkerBSD.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. linkpthread,
  267. linkdynamic,
  268. linklibc : boolean;
  269. Fl1,Fl2 : Boolean;
  270. begin
  271. WriteResponseFile:=False;
  272. { set special options for some targets }
  273. if target_info.system <> system_powerpc_darwin then
  274. begin
  275. linkdynamic:=not(SharedLibFiles.empty);
  276. linklibc:=(SharedLibFiles.Find('c')<>nil);
  277. linkpthread:=(SharedLibFiles.Find('pthread')<>nil);
  278. if (target_info.system =system_i386_freebsd) and linkpthread Then
  279. Begin
  280. if not (cs_link_pthread in aktglobalswitches) Then
  281. begin
  282. {delete pthreads from list, in this case it is in libc_r}
  283. SharedLibFiles.Remove(SharedLibFiles.Find('pthread').str);
  284. LibrarySuffix:='r';
  285. end;
  286. End;
  287. prtobj:='prt0';
  288. cprtobj:='cprt0';
  289. gprtobj:='gprt0';
  290. if cs_profile in aktmoduleswitches then
  291. begin
  292. prtobj:=gprtobj;
  293. AddSharedLibrary('c');
  294. LibrarySuffix:='p';
  295. linklibc:=true;
  296. end
  297. else
  298. begin
  299. if linklibc then
  300. prtobj:=cprtobj;
  301. end;
  302. end
  303. else
  304. begin
  305. { for darwin: always link dynamically against libc }
  306. linklibc := true;
  307. if not(isdll) then
  308. if not(cs_profile in aktmoduleswitches) then
  309. prtobj:='/usr/lib/crt1.o'
  310. else
  311. prtobj:='/usr/lib/gcrt1.o'
  312. else
  313. prtobj:='';
  314. end;
  315. { Open link.res file }
  316. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
  317. { Write path to search libraries }
  318. HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
  319. while assigned(HPath) do
  320. begin
  321. if LdSupportsNoResponseFile then
  322. LinkRes.Add(maybequoted('-L'+HPath.Str))
  323. else
  324. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  325. HPath:=TStringListItem(HPath.Next);
  326. end;
  327. HPath:=TStringListItem(LibrarySearchPath.First);
  328. while assigned(HPath) do
  329. begin
  330. if LdSupportsNoResponseFile then
  331. LinkRes.Add(maybequoted('-L'+HPath.Str))
  332. else
  333. LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')');
  334. HPath:=TStringListItem(HPath.Next);
  335. end;
  336. if not LdSupportsNoResponseFile then
  337. LinkRes.Add('INPUT(');
  338. { add objectfiles, start with prt0 always }
  339. if prtobj<>'' then
  340. LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
  341. { try to add crti and crtbegin if linking to C }
  342. if linklibc and
  343. (target_info.system <> system_powerpc_darwin) then
  344. begin
  345. if librarysearchpath.FindFile('crtbegin.o',s) then
  346. LinkRes.AddFileName(s);
  347. if librarysearchpath.FindFile('crti.o',s) then
  348. LinkRes.AddFileName(s);
  349. end;
  350. { main objectfiles }
  351. while not ObjectFiles.Empty do
  352. begin
  353. s:=ObjectFiles.GetFirst;
  354. if s<>'' then
  355. LinkRes.AddFileName(maybequoted(s));
  356. end;
  357. if not LdSupportsNoResponseFile then
  358. LinkRes.Add(')');
  359. { Write staticlibraries }
  360. if not StaticLibFiles.Empty then
  361. begin
  362. if not LdSupportsNoResponseFile then
  363. LinkRes.Add('GROUP(');
  364. While not StaticLibFiles.Empty do
  365. begin
  366. S:=StaticLibFiles.GetFirst;
  367. LinkRes.AddFileName(maybequoted(s))
  368. end;
  369. if not LdSupportsNoResponseFile then
  370. LinkRes.Add(')');
  371. end;
  372. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  373. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  374. if not SharedLibFiles.Empty then
  375. begin
  376. if not LdSupportsNoResponseFile then
  377. LinkRes.Add('INPUT(');
  378. While not SharedLibFiles.Empty do
  379. begin
  380. S:=SharedLibFiles.GetFirst;
  381. if s<>'c' then
  382. begin
  383. i:=Pos(target_info.sharedlibext,S);
  384. if i>0 then
  385. Delete(S,i,255);
  386. LinkRes.Add('-l'+s);
  387. end
  388. else
  389. begin
  390. linklibc:=true;
  391. linkdynamic:=false; { libc will include the ld-linux for us }
  392. end;
  393. end;
  394. { be sure that libc is the last lib }
  395. if linklibc then
  396. Begin
  397. If LibrarySuffix=' ' Then
  398. LinkRes.Add('-lc')
  399. else
  400. LinkRes.Add('-lc_'+LibrarySuffix);
  401. If LibrarySuffix='r' Then
  402. LinkRes.Add('-lc');
  403. end;
  404. { when we have -static for the linker the we also need libgcc }
  405. if (cs_link_staticflag in aktglobalswitches) then
  406. LinkRes.Add('-lgcc');
  407. if linkdynamic and (Info.DynamicLinker<>'') then
  408. LinkRes.AddFileName(Info.DynamicLinker);
  409. if not LdSupportsNoResponseFile then
  410. LinkRes.Add(')');
  411. end;
  412. { objects which must be at the end }
  413. if linklibc and
  414. (target_info.system <> system_powerpc_darwin) then
  415. begin
  416. Fl1:=librarysearchpath.FindFile('crtend.o',s1);
  417. Fl2:=librarysearchpath.FindFile('crtn.o',s2);
  418. if Fl1 or Fl2 then
  419. begin
  420. LinkRes.Add('INPUT(');
  421. If Fl1 Then
  422. LinkRes.AddFileName(s1);
  423. If Fl2 Then
  424. LinkRes.AddFileName(s2);
  425. LinkRes.Add(')');
  426. end;
  427. end;
  428. { ignore the fact that our relocations are in non-writable sections, }
  429. { will be fixed once we have pic support }
  430. if isdll and
  431. (target_info.system = system_powerpc_darwin) then
  432. LinkRes.Add('-read_only_relocs suppress');
  433. { Write and Close response }
  434. linkres.writetodisk;
  435. linkres.Free;
  436. WriteResponseFile:=True;
  437. end;
  438. function TLinkerBSD.MakeExecutable:boolean;
  439. var
  440. binstr : String;
  441. cmdstr : TCmdStr;
  442. success : boolean;
  443. DynLinkStr : string[60];
  444. GCSectionsStr,
  445. StaticStr,
  446. StripStr : string[40];
  447. begin
  448. if not(cs_link_extern in aktglobalswitches) then
  449. Message1(exec_i_linking,current_module.exefilename^);
  450. { Create some replacements }
  451. StaticStr:='';
  452. StripStr:='';
  453. DynLinkStr:='';
  454. GCSectionsStr:='';
  455. if (cs_link_staticflag in aktglobalswitches) then
  456. begin
  457. if (target_info.system=system_m68k_netbsd) and
  458. ((cs_link_on_target in aktglobalswitches) or
  459. (target_info.system=source_info.system)) then
  460. StaticStr:='-Bstatic'
  461. else
  462. StaticStr:='-static';
  463. end;
  464. if (cs_link_strip in aktglobalswitches) then
  465. if (target_info.system <> system_powerpc_darwin) then
  466. StripStr:='-s'
  467. else
  468. StripStr:='-x';
  469. if (cs_link_smart in aktglobalswitches) and
  470. (tf_smartlink_sections in target_info.flags) then
  471. GCSectionsStr:='--gc-sections';
  472. If (cs_profile in aktmoduleswitches) or
  473. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  474. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  475. if CShared Then
  476. DynLinKStr:=DynLinkStr+' --shared';
  477. { Write used files and libraries }
  478. WriteResponseFile(false);
  479. { Call linker }
  480. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  481. Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
  482. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  483. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  484. Replace(cmdstr,'$STATIC',StaticStr);
  485. Replace(cmdstr,'$STRIP',StripStr);
  486. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  487. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  488. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile);
  489. { Remove ReponseFile }
  490. if (success) and not(cs_link_extern in aktglobalswitches) then
  491. RemoveFile(outputexedir+Info.ResName);
  492. MakeExecutable:=success; { otherwise a recursive call to link method }
  493. end;
  494. Function TLinkerBSD.MakeSharedLibrary:boolean;
  495. var
  496. InitStr,
  497. FiniStr,
  498. SoNameStr : string[80];
  499. binstr : String;
  500. cmdstr : TCmdStr;
  501. success : boolean;
  502. begin
  503. MakeSharedLibrary:=false;
  504. if not(cs_link_extern in aktglobalswitches) then
  505. Message1(exec_i_linking,current_module.sharedlibfilename^);
  506. { Write used files and libraries }
  507. WriteResponseFile(true);
  508. InitStr:='-init FPC_LIB_START';
  509. FiniStr:='-fini FPC_LIB_EXIT';
  510. SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
  511. { Call linker }
  512. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  513. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  514. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  515. Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  516. Replace(cmdstr,'$INIT',InitStr);
  517. Replace(cmdstr,'$FINI',FiniStr);
  518. Replace(cmdstr,'$SONAME',SoNameStr);
  519. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,LdSupportsNoResponseFile);
  520. { Strip the library ? }
  521. if success and (cs_link_strip in aktglobalswitches) then
  522. begin
  523. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  524. Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
  525. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  526. end;
  527. { Remove ReponseFile }
  528. if (success) and not(cs_link_extern in aktglobalswitches) then
  529. RemoveFile(outputexedir+Info.ResName);
  530. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  531. end;
  532. {*****************************************************************************
  533. Initialize
  534. *****************************************************************************}
  535. initialization
  536. {$ifdef x86_64}
  537. RegisterExternalLinker(system_x86_64_FreeBSD_info,TLinkerBSD);
  538. RegisterImport(system_x86_64_freebsd,timportlibbsd);
  539. RegisterExport(system_x86_64_freebsd,texportlibbsd);
  540. RegisterTarget(system_x86_64_freebsd_info);
  541. {$endif}
  542. {$ifdef i386}
  543. RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD);
  544. RegisterExternalLinker(system_i386_NetBSD_info,TLinkerBSD);
  545. RegisterExternalLinker(system_i386_OpenBSD_info,TLinkerBSD);
  546. RegisterImport(system_i386_freebsd,timportlibbsd);
  547. RegisterExport(system_i386_freebsd,texportlibbsd);
  548. RegisterTarget(system_i386_freebsd_info);
  549. RegisterImport(system_i386_netbsd,timportlibbsd);
  550. RegisterExport(system_i386_netbsd,texportlibbsd);
  551. RegisterTarget(system_i386_netbsd_info);
  552. RegisterImport(system_i386_openbsd,timportlibbsd);
  553. RegisterExport(system_i386_openbsd,texportlibbsd);
  554. RegisterTarget(system_i386_openbsd_info);
  555. {$endif i386}
  556. {$ifdef m68k}
  557. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  558. RegisterExternalLinker(system_m68k_NetBSD_info,TLinkerBSD);
  559. RegisterImport(system_m68k_netbsd,timportlibbsd);
  560. RegisterExport(system_m68k_netbsd,texportlibbsd);
  561. RegisterTarget(system_m68k_netbsd_info);
  562. {$endif m68k}
  563. {$ifdef powerpc}
  564. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  565. RegisterExternalLinker(system_powerpc_darwin_info,TLinkerBSD);
  566. RegisterImport(system_powerpc_darwin,timportlibdarwin);
  567. RegisterExport(system_powerpc_darwin,texportlibbsd);
  568. RegisterTarget(system_powerpc_darwin_info);
  569. RegisterExternalLinker(system_powerpc_netbsd_info,TLinkerBSD);
  570. RegisterImport(system_powerpc_netbsd,timportlibbsd);
  571. RegisterExport(system_powerpc_netbsd,texportlibbsd);
  572. RegisterTarget(system_powerpc_netbsd_info);
  573. {$endif powerpc}
  574. end.