t_bsd.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  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. StripStr:='-s';
  455. If (cs_profile in aktmoduleswitches) or
  456. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  457. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  458. if CShared Then
  459. DynLinKStr:=DynLinkStr+' --shared';
  460. { Write used files and libraries }
  461. WriteResponseFile(false);
  462. { Call linker }
  463. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  464. Replace(cmdstr,'$EXE',current_module.exefilename^);
  465. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  466. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  467. Replace(cmdstr,'$STATIC',StaticStr);
  468. Replace(cmdstr,'$STRIP',StripStr);
  469. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  470. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile);
  471. { Remove ReponseFile }
  472. if (success) and not(cs_link_extern in aktglobalswitches) then
  473. RemoveFile(outputexedir+Info.ResName);
  474. MakeExecutable:=success; { otherwise a recursive call to link method }
  475. end;
  476. Function TLinkerBSD.MakeSharedLibrary:boolean;
  477. var
  478. binstr,
  479. cmdstr : string;
  480. success : boolean;
  481. begin
  482. MakeSharedLibrary:=false;
  483. if not(cs_link_extern in aktglobalswitches) then
  484. Message1(exec_i_linking,current_module.sharedlibfilename^);
  485. { Write used files and libraries }
  486. WriteResponseFile(true);
  487. { Call linker }
  488. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  489. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  490. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  491. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  492. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  493. { Strip the library ? }
  494. if success and (cs_link_strip in aktglobalswitches) then
  495. begin
  496. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  497. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  498. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  499. end;
  500. { Remove ReponseFile }
  501. if (success) and not(cs_link_extern in aktglobalswitches) then
  502. RemoveFile(outputexedir+Info.ResName);
  503. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  504. end;
  505. {*****************************************************************************
  506. Initialize
  507. *****************************************************************************}
  508. initialization
  509. {$ifdef i386}
  510. RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD);
  511. RegisterExternalLinker(system_i386_NetBSD_info,TLinkerBSD);
  512. RegisterExternalLinker(system_i386_OpenBSD_info,TLinkerBSD);
  513. RegisterImport(system_i386_freebsd,timportlibbsd);
  514. RegisterExport(system_i386_freebsd,texportlibbsd);
  515. RegisterTarget(system_i386_freebsd_info);
  516. RegisterImport(system_i386_netbsd,timportlibbsd);
  517. RegisterExport(system_i386_netbsd,texportlibbsd);
  518. RegisterTarget(system_i386_netbsd_info);
  519. RegisterImport(system_i386_openbsd,timportlibbsd);
  520. RegisterExport(system_i386_openbsd,texportlibbsd);
  521. RegisterTarget(system_i386_openbsd_info);
  522. {$endif i386}
  523. {$ifdef m68k}
  524. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  525. RegisterExternalLinker(system_m68k_NetBSD_info,TLinkerBSD);
  526. RegisterImport(system_m68k_netbsd,timportlibbsd);
  527. RegisterExport(system_m68k_netbsd,texportlibbsd);
  528. RegisterTarget(system_m68k_netbsd_info);
  529. {$endif m68k}
  530. {$ifdef powerpc}
  531. // RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD);
  532. RegisterExternalLinker(system_powerpc_darwin_info,TLinkerBSD);
  533. RegisterImport(system_powerpc_darwin,timportlibdarwin);
  534. RegisterExport(system_powerpc_darwin,texportlibbsd);
  535. RegisterTarget(system_powerpc_darwin_info);
  536. RegisterExternalLinker(system_powerpc_netbsd_info,TLinkerBSD);
  537. RegisterImport(system_powerpc_netbsd,timportlibbsd);
  538. RegisterExport(system_powerpc_netbsd,texportlibbsd);
  539. RegisterTarget(system_powerpc_netbsd_info);
  540. {$endif powerpc}
  541. end.
  542. {
  543. $Log$
  544. Revision 1.16 2004-06-02 07:03:49 jonas
  545. - disabled automatic adding of libraries from "external lib name 'xxx'"
  546. for now (until we have proper framework support)
  547. Revision 1.15 2004/05/31 18:08:41 jonas
  548. * changed calling of external procedures to be the same as under gcc
  549. (don't worry about all the generated stubs, they're optimized away
  550. by the linker)
  551. -> side effect: no need anymore to use special declarations for
  552. external C functions under Darwin compared to other platforms
  553. (it's still necessary for variables though)
  554. Revision 1.14 2004/04/04 10:53:21 marco
  555. * small c_r fix, also link plain libc (like for x11)
  556. Revision 1.13 2004/03/29 21:19:33 florian
  557. * imported procedures are always made global (in the sense of the
  558. assembler)
  559. Revision 1.12 2004/03/05 22:17:11 jonas
  560. * fixed importing of variables from shared libraries, but disabled
  561. PIC support for now. You have to save/restore r31 when you us it! :)
  562. Also, it's not necessary to support the imported variables
  563. Revision 1.11 2004/03/02 00:36:33 olle
  564. * big transformation of Tai_[const_]Symbol.Create[data]name*
  565. Revision 1.10 2004/02/27 10:21:05 florian
  566. * top_symbol killed
  567. + refaddr to treference added
  568. + refsymbol to treference added
  569. * top_local stuff moved to an extra record to save memory
  570. + aint introduced
  571. * tppufile.get/putint64/aint implemented
  572. Revision 1.9 2004/02/15 16:34:18 marco
  573. * pthread on -CURRENT related fixes.
  574. Revision 1.8 2004/01/21 20:53:51 marco
  575. * Copy and pasted some structures from Net- to OpenBSD (3.4+ ELF!)
  576. Revision 1.7 2004/01/05 08:13:30 jonas
  577. * fixed compilation problems under x86
  578. Revision 1.6 2004/01/04 21:26:31 jonas
  579. + Darwin support for routines imported from external libraries (not yet
  580. ideal, we should generate stubs in all files where the routines are
  581. used -> these are automatically merged by the linker; now we generate
  582. one global symbol with a jump to a stub in unit where the routine is
  583. declared)
  584. + (not yet working) Darwin support for imported variables
  585. + Darwin support for linking
  586. Revision 1.5 2003/10/30 18:35:30 marco
  587. * librarysuffix + profiling
  588. Revision 1.4 2003/10/11 19:32:04 marco
  589. * -Xd
  590. Revision 1.3 2003/10/03 14:16:48 marco
  591. * -XP<prefix> support
  592. Revision 1.2 2003/05/25 23:15:04 marco
  593. * NetBSD target support. OpenBSD reserved in the enum, for future use.
  594. Revision 1.1 2003/05/20 23:54:00 florian
  595. + basic darwin support added
  596. Revision 1.5 2003/04/27 07:29:52 peter
  597. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  598. a new procdef declaration
  599. * aktprocsym removed
  600. * lexlevel removed, use symtable.symtablelevel instead
  601. * implicit init/final code uses the normal genentry/genexit
  602. * funcret state checking updated for new funcret handling
  603. Revision 1.4 2003/04/26 09:16:08 peter
  604. * .o files belonging to the unit are first searched in the same dir
  605. as the .ppu
  606. Revision 1.3 2003/01/18 16:16:13 marco
  607. * Small fix for netbsd
  608. Revision 1.2 2002/09/09 17:34:17 peter
  609. * tdicationary.replace added to replace and item in a dictionary. This
  610. is only allowed for the same name
  611. * varsyms are inserted in symtable before the types are parsed. This
  612. fixes the long standing "var longint : longint" bug
  613. - consume_idlist and idstringlist removed. The loops are inserted
  614. at the callers place and uses the symtable for duplicate id checking
  615. Revision 1.1 2002/09/06 15:03:51 carl
  616. * moved files to systems directory
  617. Revision 1.29 2002/09/03 16:26:28 daniel
  618. * Make Tprocdef.defs protected
  619. Revision 1.28 2002/08/12 15:08:44 carl
  620. + stab register indexes for powerpc (moved from gdb to cpubase)
  621. + tprocessor enumeration moved to cpuinfo
  622. + linker in target_info is now a class
  623. * many many updates for m68k (will soon start to compile)
  624. - removed some ifdef or correct them for correct cpu
  625. Revision 1.27 2002/08/11 14:32:32 peter
  626. * renamed current_library to objectlibrary
  627. Revision 1.26 2002/08/11 13:24:19 peter
  628. * saving of asmsymbols in ppu supported
  629. * asmsymbollist global is removed and moved into a new class
  630. tasmlibrarydata that will hold the info of a .a file which
  631. corresponds with a single module. Added librarydata to tmodule
  632. to keep the library info stored for the module. In the future the
  633. objectfiles will also be stored to the tasmlibrarydata class
  634. * all getlabel/newasmsymbol and friends are moved to the new class
  635. Revision 1.25 2002/07/26 21:15:45 florian
  636. * rewrote the system handling
  637. Revision 1.24 2002/07/24 13:51:34 marco
  638. * Fixed small error
  639. Revision 1.23 2002/07/24 13:10:22 marco
  640. * urgent fix.
  641. Revision 1.22 2002/07/01 18:46:34 peter
  642. * internal linker
  643. * reorganized aasm layer
  644. Revision 1.21 2002/05/18 13:34:26 peter
  645. * readded missing revisions
  646. Revision 1.20 2002/05/16 19:46:53 carl
  647. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  648. + try to fix temp allocation (still in ifdef)
  649. + generic constructor calls
  650. + start of tassembler / tmodulebase class cleanup
  651. Revision 1.18 2002/04/22 18:19:22 carl
  652. - remove use_bound_instruction field
  653. Revision 1.17 2002/04/20 21:43:18 carl
  654. * fix stack size for some targets
  655. + add offset to parameters from frame pointer info.
  656. - remove some unused stuff
  657. Revision 1.16 2002/04/19 15:46:04 peter
  658. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  659. in most cases and not written to the ppu
  660. * add mangeledname_prefix() routine to generate the prefix of
  661. manglednames depending on the current procedure, object and module
  662. * removed static procprefix since the mangledname is now build only
  663. on demand from tprocdef.mangledname
  664. Revision 1.15 2002/04/15 19:16:57 carl
  665. - remove size_of_pointer field
  666. Revision 1.14 2002/01/29 21:27:34 peter
  667. * default alignment changed to 4 bytes for locals and static const,var
  668. }