t_bsd.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Peter Vreman (original Linux)
  4. (c) 2000 by Marco van de Voort (FreeBSD mods)
  5. This unit implements support import,export,link routines
  6. for the (i386)FreeBSD target
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ****************************************************************************
  19. }
  20. unit t_bsd;
  21. {$i fpcdefs.inc}
  22. interface
  23. implementation
  24. uses
  25. {$ifdef gdb}
  26. gdb,
  27. {$endif gdb}
  28. cutils,cclasses,
  29. verbose,systems,globtype,globals,
  30. symconst,script,
  31. fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef,
  32. import,export,link,i_bsd,
  33. cgutils,cgbase,cgobj;
  34. type
  35. tdarwinimported_item = class(timported_item)
  36. procdef : tprocdef;
  37. end;
  38. timportlibdarwin=class(timportlib)
  39. procedure preparelib(const s:string);override;
  40. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  41. procedure importvariable(vs:tvarsym;const name,module:string);override;
  42. procedure generatelib;override;
  43. procedure generatesmartlib;override;
  44. end;
  45. timportlibbsd=class(timportlib)
  46. procedure preparelib(const s:string);override;
  47. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  48. procedure importvariable(vs:tvarsym;const name,module:string);override;
  49. procedure generatelib;override;
  50. end;
  51. texportlibbsd=class(texportlib)
  52. procedure preparelib(const s : string);override;
  53. procedure exportprocedure(hp : texported_item);override;
  54. procedure exportvar(hp : texported_item);override;
  55. procedure generatelib;override;
  56. end;
  57. tlinkerbsd=class(texternallinker)
  58. private
  59. LdSupportsNoResponseFile : boolean;
  60. LibrarySuffix : Char;
  61. Function WriteResponseFile(isdll:boolean) : Boolean;
  62. public
  63. constructor Create;override;
  64. procedure SetDefaultInfo;override;
  65. function MakeExecutable:boolean;override;
  66. function MakeSharedLibrary:boolean;override;
  67. end;
  68. {*****************************************************************************
  69. TIMPORTLIBDARWIN
  70. *****************************************************************************}
  71. procedure timportlibdarwin.preparelib(const s : string);
  72. begin
  73. if not(assigned(importssection)) then
  74. importssection:=TAAsmoutput.create;
  75. end;
  76. procedure timportlibdarwin.importprocedure(aprocdef:tprocdef;const module : string;index : longint;const name : string);
  77. begin
  78. { insert sharedlibrary }
  79. { current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
  80. { force the mangledname }
  81. if assigned(aprocdef) then
  82. begin
  83. if (aprocdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
  84. aprocdef.setmangledname(target_info.Cprefix+name)
  85. else
  86. aprocdef.setmangledname(name);
  87. end;
  88. end;
  89. procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
  90. begin
  91. { insert sharedlibrary }
  92. { current_module.linkothersharedlibs.add(SplitName(module),link_allways); }
  93. { the rest is handled in the nppcld.pas tppcloadnode }
  94. vs.set_mangledname(name);
  95. end;
  96. procedure timportlibdarwin.generatesmartlib;
  97. begin
  98. generatelib;
  99. end;
  100. procedure timportlibdarwin.generatelib;
  101. begin
  102. end;
  103. {*****************************************************************************
  104. TIMPORTLIBBSD
  105. *****************************************************************************}
  106. procedure timportlibbsd.preparelib(const s : string);
  107. begin
  108. end;
  109. procedure timportlibbsd.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
  110. begin
  111. { insert sharedlibrary }
  112. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  113. { do nothing with the procedure, only set the mangledname }
  114. if name<>'' then
  115. begin
  116. aprocdef.setmangledname(name);
  117. end
  118. else
  119. message(parser_e_empty_import_name);
  120. end;
  121. procedure timportlibbsd.importvariable(vs:tvarsym;const name,module:string);
  122. begin
  123. { insert sharedlibrary }
  124. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  125. { reset the mangledname and turn off the dll_var option }
  126. vs.set_mangledname(name);
  127. exclude(vs.varoptions,vo_is_dll_var);
  128. end;
  129. procedure timportlibbsd.generatelib;
  130. begin
  131. end;
  132. {*****************************************************************************
  133. TEXPORTLIBBSD
  134. *****************************************************************************}
  135. procedure texportlibbsd.preparelib(const s:string);
  136. begin
  137. end;
  138. procedure texportlibbsd.exportprocedure(hp : texported_item);
  139. var
  140. hp2 : texported_item;
  141. begin
  142. { first test the index value }
  143. if (hp.options and eo_index)<>0 then
  144. begin
  145. Message1(parser_e_no_export_with_index_for_target,'freebsd');
  146. exit;
  147. end;
  148. { now place in correct order }
  149. hp2:=texported_item(current_module._exports.first);
  150. while assigned(hp2) and
  151. (hp.name^>hp2.name^) do
  152. hp2:=texported_item(hp2.next);
  153. { insert hp there !! }
  154. if assigned(hp2) and (hp2.name^=hp.name^) then
  155. begin
  156. { this is not allowed !! }
  157. Message1(parser_e_export_name_double,hp.name^);
  158. exit;
  159. end;
  160. if hp2=texported_item(current_module._exports.first) then
  161. current_module._exports.concat(hp)
  162. else if assigned(hp2) then
  163. begin
  164. hp.next:=hp2;
  165. hp.previous:=hp2.previous;
  166. if assigned(hp2.previous) then
  167. hp2.previous.next:=hp;
  168. hp2.previous:=hp;
  169. end
  170. else
  171. current_module._exports.concat(hp);
  172. end;
  173. procedure texportlibbsd.exportvar(hp : texported_item);
  174. begin
  175. hp.is_var:=true;
  176. exportprocedure(hp);
  177. end;
  178. procedure texportlibbsd.generatelib;
  179. var
  180. hp2 : texported_item;
  181. begin
  182. hp2:=texported_item(current_module._exports.first);
  183. while assigned(hp2) do
  184. begin
  185. if (not hp2.is_var) and
  186. (hp2.sym.typ=procsym) then
  187. begin
  188. { the manglednames can already be the same when the procedure
  189. is declared with cdecl }
  190. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  191. begin
  192. {$ifdef i386}
  193. { place jump in codesegment }
  194. codesegment.concat(Tai_align.Create_op(4,$90));
  195. codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  196. codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  197. codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
  198. {$endif i386}
  199. end;
  200. end
  201. else
  202. Message1(parser_e_no_export_of_variables_for_target,'freebsd');
  203. hp2:=texported_item(hp2.next);
  204. end;
  205. end;
  206. {*****************************************************************************
  207. TLINKERLINUX
  208. *****************************************************************************}
  209. Constructor TLinkerBSD.Create;
  210. begin
  211. Inherited Create;
  212. if not Dontlinkstdlibpath Then
  213. if (target_info.system <> system_powerpc_darwin) then
  214. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true)
  215. else
  216. { Mac OS X doesn't have a /lib }
  217. LibrarySearchPath.AddPath('/usr/lib',true)
  218. end;
  219. procedure TLinkerBSD.SetDefaultInfo;
  220. {
  221. This will also detect which libc version will be used
  222. }
  223. begin
  224. LibrarySuffix:=' ';
  225. LdSupportsNoResponseFile := (target_info.system in [system_m68k_netbsd,system_powerpc_darwin]);
  226. with Info do
  227. begin
  228. if LdSupportsNoResponseFile then
  229. begin
  230. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE `cat $RES`';
  231. end
  232. else
  233. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
  234. DllCmd[1]:='ld $OPT -shared -L. -o $EXE $RES';
  235. DllCmd[2]:='strip --strip-unneeded $EXE';
  236. { first try glibc2 }
  237. {$ifdef GLIBC2} {Keep linux code in place. FBSD might go to a different
  238. glibc too once}
  239. DynamicLinker:='/lib/ld-linux.so.2';
  240. if FileExists(DynamicLinker) then
  241. begin
  242. Glibc2:=true;
  243. { Check for 2.0 files, else use the glibc 2.1 stub }
  244. if FileExists('/lib/ld-2.0.*') then
  245. Glibc21:=false
  246. else
  247. Glibc21:=true;
  248. end
  249. else
  250. DynamicLinker:='/lib/ld-linux.so.1';
  251. {$else}
  252. DynamicLinker:='';
  253. {$endif}
  254. end;
  255. end;
  256. Function TLinkerBSD.WriteResponseFile(isdll:boolean) : Boolean;
  257. Var
  258. linkres : TLinkRes;
  259. i : longint;
  260. cprtobj,
  261. gprtobj,
  262. prtobj : string[80];
  263. HPath : TStringListItem;
  264. s,s1,s2 : string;
  265. linkpthread,
  266. linkdynamic,
  267. linklibc : boolean;
  268. Fl1,Fl2 : Boolean;
  269. begin
  270. WriteResponseFile:=False;
  271. { set special options for some targets }
  272. if target_info.system <> system_powerpc_darwin then
  273. begin
  274. linkdynamic:=not(SharedLibFiles.empty);
  275. linklibc:=(SharedLibFiles.Find('c')<>nil);
  276. linkpthread:=(SharedLibFiles.Find('pthread')<>nil);
  277. if (target_info.system =system_i386_freebsd) and linkpthread Then
  278. Begin
  279. if not (cs_link_pthread in aktglobalswitches) Then
  280. begin
  281. {delete pthreads from list, in this case it is in libc_r}
  282. SharedLibFiles.Remove(SharedLibFiles.Find('pthread').str);
  283. LibrarySuffix:='r';
  284. end;
  285. End;
  286. prtobj:='prt0';
  287. cprtobj:='cprt0';
  288. gprtobj:='gprt0';
  289. if cs_profile in aktmoduleswitches then
  290. begin
  291. prtobj:=gprtobj;
  292. AddSharedLibrary('c');
  293. LibrarySuffix:='p';
  294. linklibc:=true;
  295. end
  296. else
  297. begin
  298. if linklibc then
  299. prtobj:=cprtobj;
  300. end;
  301. end
  302. else
  303. begin
  304. { for darwin: always link dynamically against libc }
  305. linklibc := true;
  306. if not(cs_profile in aktmoduleswitches) then
  307. prtobj:='/usr/lib/crt1.o'
  308. else
  309. prtobj:='/usr/lib/gcrt1.o';
  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. if LdSupportsNoResponseFile then
  318. LinkRes.Add('-L'+HPath.Str)
  319. else
  320. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  321. HPath:=TStringListItem(HPath.Next);
  322. end;
  323. HPath:=TStringListItem(LibrarySearchPath.First);
  324. while assigned(HPath) do
  325. begin
  326. if LdSupportsNoResponseFile then
  327. LinkRes.Add('-L'+HPath.Str)
  328. else
  329. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  330. HPath:=TStringListItem(HPath.Next);
  331. end;
  332. if not LdSupportsNoResponseFile then
  333. LinkRes.Add('INPUT(');
  334. { add objectfiles, start with prt0 always }
  335. if prtobj<>'' then
  336. LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
  337. { try to add crti and crtbegin if linking to C }
  338. if linklibc and
  339. (target_info.system <> system_powerpc_darwin) then
  340. begin
  341. if librarysearchpath.FindFile('crtbegin.o',s) then
  342. LinkRes.AddFileName(s);
  343. if librarysearchpath.FindFile('crti.o',s) then
  344. LinkRes.AddFileName(s);
  345. end;
  346. { main objectfiles }
  347. while not ObjectFiles.Empty do
  348. begin
  349. s:=ObjectFiles.GetFirst;
  350. if s<>'' then
  351. LinkRes.AddFileName(s);
  352. end;
  353. if not LdSupportsNoResponseFile then
  354. LinkRes.Add(')');
  355. { Write staticlibraries }
  356. if not StaticLibFiles.Empty then
  357. begin
  358. if not LdSupportsNoResponseFile then
  359. LinkRes.Add('GROUP(');
  360. While not StaticLibFiles.Empty do
  361. begin
  362. S:=StaticLibFiles.GetFirst;
  363. LinkRes.AddFileName(s)
  364. end;
  365. if not LdSupportsNoResponseFile then
  366. LinkRes.Add(')');
  367. end;
  368. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  369. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  370. if not SharedLibFiles.Empty then
  371. begin
  372. if not LdSupportsNoResponseFile then
  373. LinkRes.Add('INPUT(');
  374. While not SharedLibFiles.Empty do
  375. begin
  376. S:=SharedLibFiles.GetFirst;
  377. if s<>'c' then
  378. begin
  379. i:=Pos(target_info.sharedlibext,S);
  380. if i>0 then
  381. Delete(S,i,255);
  382. LinkRes.Add('-l'+s);
  383. end
  384. else
  385. begin
  386. linklibc:=true;
  387. linkdynamic:=false; { libc will include the ld-linux for us }
  388. end;
  389. end;
  390. { be sure that libc is the last lib }
  391. if linklibc then
  392. Begin
  393. If LibrarySuffix=' ' Then
  394. LinkRes.Add('-lc')
  395. else
  396. LinkRes.Add('-lc_'+LibrarySuffix);
  397. If LibrarySuffix='r' Then
  398. LinkRes.Add('-lc');
  399. end;
  400. { when we have -static for the linker the we also need libgcc }
  401. if (cs_link_staticflag in aktglobalswitches) then
  402. LinkRes.Add('-lgcc');
  403. if linkdynamic and (Info.DynamicLinker<>'') then
  404. LinkRes.AddFileName(Info.DynamicLinker);
  405. if not LdSupportsNoResponseFile then
  406. LinkRes.Add(')');
  407. end;
  408. { objects which must be at the end }
  409. if linklibc and
  410. (target_info.system <> system_powerpc_darwin) then
  411. begin
  412. Fl1:=librarysearchpath.FindFile('crtend.o',s1);
  413. Fl2:=librarysearchpath.FindFile('crtn.o',s2);
  414. if Fl1 or Fl2 then
  415. begin
  416. LinkRes.Add('INPUT(');
  417. If Fl1 Then
  418. LinkRes.AddFileName(s1);
  419. If Fl2 Then
  420. LinkRes.AddFileName(s2);
  421. LinkRes.Add(')');
  422. end;
  423. end;
  424. { Write and Close response }
  425. linkres.writetodisk;
  426. linkres.Free;
  427. WriteResponseFile:=True;
  428. end;
  429. function TLinkerBSD.MakeExecutable:boolean;
  430. var
  431. binstr,
  432. cmdstr : string;
  433. success : boolean;
  434. DynLinkStr : string[60];
  435. StaticStr,
  436. StripStr : string[40];
  437. begin
  438. if not(cs_link_extern in aktglobalswitches) then
  439. Message1(exec_i_linking,current_module.exefilename^);
  440. { Create some replacements }
  441. StaticStr:='';
  442. StripStr:='';
  443. DynLinkStr:='';
  444. if (cs_link_staticflag in aktglobalswitches) then
  445. begin
  446. if (target_info.system=system_m68k_netbsd) and
  447. ((cs_link_on_target in aktglobalswitches) or
  448. (target_info.system=source_info.system)) then
  449. StaticStr:='-Bstatic'
  450. else
  451. StaticStr:='-static';
  452. end;
  453. if (cs_link_strip in aktglobalswitches) then
  454. if (target_info.system <> system_powerpc_darwin) then
  455. StripStr:='-s'
  456. else
  457. StripStr:='-x';
  458. If (cs_profile in aktmoduleswitches) or
  459. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  460. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  461. if CShared Then
  462. DynLinKStr:=DynLinkStr+' --shared';
  463. { Write used files and libraries }
  464. WriteResponseFile(false);
  465. { Call linker }
  466. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  467. Replace(cmdstr,'$EXE',current_module.exefilename^);
  468. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  469. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  470. Replace(cmdstr,'$STATIC',StaticStr);
  471. Replace(cmdstr,'$STRIP',StripStr);
  472. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  473. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile);
  474. { Remove ReponseFile }
  475. if (success) and not(cs_link_extern in aktglobalswitches) then
  476. RemoveFile(outputexedir+Info.ResName);
  477. MakeExecutable:=success; { otherwise a recursive call to link method }
  478. end;
  479. Function TLinkerBSD.MakeSharedLibrary:boolean;
  480. var
  481. binstr,
  482. cmdstr : string;
  483. success : boolean;
  484. begin
  485. MakeSharedLibrary:=false;
  486. if not(cs_link_extern in aktglobalswitches) then
  487. Message1(exec_i_linking,current_module.sharedlibfilename^);
  488. { Write used files and libraries }
  489. WriteResponseFile(true);
  490. { Call linker }
  491. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  492. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  493. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  494. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  495. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  496. { Strip the library ? }
  497. if success and (cs_link_strip in aktglobalswitches) then
  498. begin
  499. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  500. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  501. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  502. end;
  503. { Remove ReponseFile }
  504. if (success) and not(cs_link_extern in aktglobalswitches) then
  505. RemoveFile(outputexedir+Info.ResName);
  506. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  507. end;
  508. {*****************************************************************************
  509. Initialize
  510. *****************************************************************************}
  511. initialization
  512. {$ifdef i386}
  513. RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD);
  514. RegisterExternalLinker(system_i386_NetBSD_info,TLinkerBSD);
  515. RegisterExternalLinker(system_i386_OpenBSD_info,TLinkerBSD);
  516. RegisterImport(system_i386_freebsd,timportlibbsd);
  517. RegisterExport(system_i386_freebsd,texportlibbsd);
  518. RegisterTarget(system_i386_freebsd_info);
  519. RegisterImport(system_i386_netbsd,timportlibbsd);
  520. RegisterExport(system_i386_netbsd,texportlibbsd);
  521. RegisterTarget(system_i386_netbsd_info);
  522. RegisterImport(system_i386_openbsd,timportlibbsd);
  523. RegisterExport(system_i386_openbsd,texportlibbsd);
  524. RegisterTarget(system_i386_openbsd_info);
  525. {$endif i386}
  526. {$ifdef m68k}
  527. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  528. RegisterExternalLinker(system_m68k_NetBSD_info,TLinkerBSD);
  529. RegisterImport(system_m68k_netbsd,timportlibbsd);
  530. RegisterExport(system_m68k_netbsd,texportlibbsd);
  531. RegisterTarget(system_m68k_netbsd_info);
  532. {$endif m68k}
  533. {$ifdef powerpc}
  534. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  535. RegisterExternalLinker(system_powerpc_darwin_info,TLinkerBSD);
  536. RegisterImport(system_powerpc_darwin,timportlibdarwin);
  537. RegisterExport(system_powerpc_darwin,texportlibbsd);
  538. RegisterTarget(system_powerpc_darwin_info);
  539. RegisterExternalLinker(system_powerpc_netbsd_info,TLinkerBSD);
  540. RegisterImport(system_powerpc_netbsd,timportlibbsd);
  541. RegisterExport(system_powerpc_netbsd,texportlibbsd);
  542. RegisterTarget(system_powerpc_netbsd_info);
  543. {$endif powerpc}
  544. end.
  545. {
  546. $Log$
  547. Revision 1.17 2004-06-08 17:14:49 jonas
  548. * use -x instead of -s for stripping under Mac OS X (-s strips too much
  549. sometimes)
  550. Revision 1.16 2004/06/02 07:03:49 jonas
  551. - disabled automatic adding of libraries from "external lib name 'xxx'"
  552. for now (until we have proper framework support)
  553. Revision 1.15 2004/05/31 18:08:41 jonas
  554. * changed calling of external procedures to be the same as under gcc
  555. (don't worry about all the generated stubs, they're optimized away
  556. by the linker)
  557. -> side effect: no need anymore to use special declarations for
  558. external C functions under Darwin compared to other platforms
  559. (it's still necessary for variables though)
  560. Revision 1.14 2004/04/04 10:53:21 marco
  561. * small c_r fix, also link plain libc (like for x11)
  562. Revision 1.13 2004/03/29 21:19:33 florian
  563. * imported procedures are always made global (in the sense of the
  564. assembler)
  565. Revision 1.12 2004/03/05 22:17:11 jonas
  566. * fixed importing of variables from shared libraries, but disabled
  567. PIC support for now. You have to save/restore r31 when you us it! :)
  568. Also, it's not necessary to support the imported variables
  569. Revision 1.11 2004/03/02 00:36:33 olle
  570. * big transformation of Tai_[const_]Symbol.Create[data]name*
  571. Revision 1.10 2004/02/27 10:21:05 florian
  572. * top_symbol killed
  573. + refaddr to treference added
  574. + refsymbol to treference added
  575. * top_local stuff moved to an extra record to save memory
  576. + aint introduced
  577. * tppufile.get/putint64/aint implemented
  578. Revision 1.9 2004/02/15 16:34:18 marco
  579. * pthread on -CURRENT related fixes.
  580. Revision 1.8 2004/01/21 20:53:51 marco
  581. * Copy and pasted some structures from Net- to OpenBSD (3.4+ ELF!)
  582. Revision 1.7 2004/01/05 08:13:30 jonas
  583. * fixed compilation problems under x86
  584. Revision 1.6 2004/01/04 21:26:31 jonas
  585. + Darwin support for routines imported from external libraries (not yet
  586. ideal, we should generate stubs in all files where the routines are
  587. used -> these are automatically merged by the linker; now we generate
  588. one global symbol with a jump to a stub in unit where the routine is
  589. declared)
  590. + (not yet working) Darwin support for imported variables
  591. + Darwin support for linking
  592. Revision 1.5 2003/10/30 18:35:30 marco
  593. * librarysuffix + profiling
  594. Revision 1.4 2003/10/11 19:32:04 marco
  595. * -Xd
  596. Revision 1.3 2003/10/03 14:16:48 marco
  597. * -XP<prefix> support
  598. Revision 1.2 2003/05/25 23:15:04 marco
  599. * NetBSD target support. OpenBSD reserved in the enum, for future use.
  600. Revision 1.1 2003/05/20 23:54:00 florian
  601. + basic darwin support added
  602. Revision 1.5 2003/04/27 07:29:52 peter
  603. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  604. a new procdef declaration
  605. * aktprocsym removed
  606. * lexlevel removed, use symtable.symtablelevel instead
  607. * implicit init/final code uses the normal genentry/genexit
  608. * funcret state checking updated for new funcret handling
  609. Revision 1.4 2003/04/26 09:16:08 peter
  610. * .o files belonging to the unit are first searched in the same dir
  611. as the .ppu
  612. Revision 1.3 2003/01/18 16:16:13 marco
  613. * Small fix for netbsd
  614. Revision 1.2 2002/09/09 17:34:17 peter
  615. * tdicationary.replace added to replace and item in a dictionary. This
  616. is only allowed for the same name
  617. * varsyms are inserted in symtable before the types are parsed. This
  618. fixes the long standing "var longint : longint" bug
  619. - consume_idlist and idstringlist removed. The loops are inserted
  620. at the callers place and uses the symtable for duplicate id checking
  621. Revision 1.1 2002/09/06 15:03:51 carl
  622. * moved files to systems directory
  623. Revision 1.29 2002/09/03 16:26:28 daniel
  624. * Make Tprocdef.defs protected
  625. Revision 1.28 2002/08/12 15:08:44 carl
  626. + stab register indexes for powerpc (moved from gdb to cpubase)
  627. + tprocessor enumeration moved to cpuinfo
  628. + linker in target_info is now a class
  629. * many many updates for m68k (will soon start to compile)
  630. - removed some ifdef or correct them for correct cpu
  631. Revision 1.27 2002/08/11 14:32:32 peter
  632. * renamed current_library to objectlibrary
  633. Revision 1.26 2002/08/11 13:24:19 peter
  634. * saving of asmsymbols in ppu supported
  635. * asmsymbollist global is removed and moved into a new class
  636. tasmlibrarydata that will hold the info of a .a file which
  637. corresponds with a single module. Added librarydata to tmodule
  638. to keep the library info stored for the module. In the future the
  639. objectfiles will also be stored to the tasmlibrarydata class
  640. * all getlabel/newasmsymbol and friends are moved to the new class
  641. Revision 1.25 2002/07/26 21:15:45 florian
  642. * rewrote the system handling
  643. Revision 1.24 2002/07/24 13:51:34 marco
  644. * Fixed small error
  645. Revision 1.23 2002/07/24 13:10:22 marco
  646. * urgent fix.
  647. Revision 1.22 2002/07/01 18:46:34 peter
  648. * internal linker
  649. * reorganized aasm layer
  650. Revision 1.21 2002/05/18 13:34:26 peter
  651. * readded missing revisions
  652. Revision 1.20 2002/05/16 19:46:53 carl
  653. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  654. + try to fix temp allocation (still in ifdef)
  655. + generic constructor calls
  656. + start of tassembler / tmodulebase class cleanup
  657. Revision 1.18 2002/04/22 18:19:22 carl
  658. - remove use_bound_instruction field
  659. Revision 1.17 2002/04/20 21:43:18 carl
  660. * fix stack size for some targets
  661. + add offset to parameters from frame pointer info.
  662. - remove some unused stuff
  663. Revision 1.16 2002/04/19 15:46:04 peter
  664. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  665. in most cases and not written to the ppu
  666. * add mangeledname_prefix() routine to generate the prefix of
  667. manglednames depending on the current procedure, object and module
  668. * removed static procprefix since the mangledname is now build only
  669. on demand from tprocdef.mangledname
  670. Revision 1.15 2002/04/15 19:16:57 carl
  671. - remove size_of_pointer field
  672. Revision 1.14 2002/01/29 21:27:34 peter
  673. * default alignment changed to 4 bytes for locals and static const,var
  674. }