t_bsd.pas 20 KB

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