t_linux.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Peter Vreman
  4. This unit implements support import,export,link routines
  5. for the (i386) Linux 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_linux;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. symsym,symdef,
  24. import,export,link;
  25. type
  26. timportliblinux=class(timportlib)
  27. procedure preparelib(const s:string);override;
  28. procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
  29. procedure importvariable(vs:tvarsym;const name,module:string);override;
  30. procedure generatelib;override;
  31. end;
  32. texportliblinux=class(texportlib)
  33. procedure preparelib(const s : string);override;
  34. procedure exportprocedure(hp : texported_item);override;
  35. procedure exportvar(hp : texported_item);override;
  36. procedure generatelib;override;
  37. end;
  38. tlinkerlinux=class(texternallinker)
  39. private
  40. Glibc2,
  41. Glibc21 : boolean;
  42. Function WriteResponseFile(isdll:boolean) : Boolean;
  43. public
  44. constructor Create;override;
  45. procedure SetDefaultInfo;override;
  46. function MakeExecutable:boolean;override;
  47. function MakeSharedLibrary:boolean;override;
  48. end;
  49. implementation
  50. uses
  51. cutils,cclasses,
  52. verbose,systems,globtype,globals,
  53. symconst,script,
  54. fmodule,dos
  55. ,aasmbase,aasmtai,aasmcpu,cpubase
  56. ,i_linux
  57. ;
  58. {*****************************************************************************
  59. TIMPORTLIBLINUX
  60. *****************************************************************************}
  61. procedure timportliblinux.preparelib(const s : string);
  62. begin
  63. end;
  64. procedure timportliblinux.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
  65. begin
  66. { insert sharedlibrary }
  67. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  68. { do nothing with the procedure, only set the mangledname }
  69. if name<>'' then
  70. begin
  71. aprocdef.setmangledname(name);
  72. end
  73. else
  74. message(parser_e_empty_import_name);
  75. end;
  76. procedure timportliblinux.importvariable(vs:tvarsym;const name,module:string);
  77. begin
  78. { insert sharedlibrary }
  79. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  80. { reset the mangledname and turn off the dll_var option }
  81. vs.set_mangledname(name);
  82. exclude(vs.varoptions,vo_is_dll_var);
  83. end;
  84. procedure timportliblinux.generatelib;
  85. begin
  86. end;
  87. {*****************************************************************************
  88. TEXPORTLIBLINUX
  89. *****************************************************************************}
  90. procedure texportliblinux.preparelib(const s:string);
  91. begin
  92. end;
  93. procedure texportliblinux.exportprocedure(hp : texported_item);
  94. var
  95. hp2 : texported_item;
  96. begin
  97. { first test the index value }
  98. if (hp.options and eo_index)<>0 then
  99. begin
  100. Message1(parser_e_no_export_with_index_for_target,'linux');
  101. exit;
  102. end;
  103. { now place in correct order }
  104. hp2:=texported_item(current_module._exports.first);
  105. while assigned(hp2) and
  106. (hp.name^>hp2.name^) do
  107. hp2:=texported_item(hp2.next);
  108. { insert hp there !! }
  109. if assigned(hp2) and (hp2.name^=hp.name^) then
  110. begin
  111. { this is not allowed !! }
  112. Message1(parser_e_export_name_double,hp.name^);
  113. exit;
  114. end;
  115. if hp2=texported_item(current_module._exports.first) then
  116. current_module._exports.concat(hp)
  117. else if assigned(hp2) then
  118. begin
  119. hp.next:=hp2;
  120. hp.previous:=hp2.previous;
  121. if assigned(hp2.previous) then
  122. hp2.previous.next:=hp;
  123. hp2.previous:=hp;
  124. end
  125. else
  126. current_module._exports.concat(hp);
  127. end;
  128. procedure texportliblinux.exportvar(hp : texported_item);
  129. begin
  130. hp.is_var:=true;
  131. exportprocedure(hp);
  132. end;
  133. procedure texportliblinux.generatelib;
  134. var
  135. hp2 : texported_item;
  136. begin
  137. hp2:=texported_item(current_module._exports.first);
  138. while assigned(hp2) do
  139. begin
  140. if (not hp2.is_var) and
  141. (hp2.sym.typ=procsym) then
  142. begin
  143. { the manglednames can already be the same when the procedure
  144. is declared with cdecl }
  145. if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
  146. begin
  147. {$ifdef i386}
  148. { place jump in codesegment }
  149. codesegment.concat(Tai_align.Create_op(4,$90));
  150. codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
  151. codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  152. codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
  153. {$else i386}
  154. {$ifdef m68k}
  155. { place jump in codesegment }
  156. codesegment.concat(tai_align.create(4));
  157. codesegment.concat(tai_symbol.createname_global(hp2.name^,AT_FUNCTION,0));
  158. codesegment.concat(taicpu.op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  159. codesegment.concat(tai_symbol_end.createname(hp2.name^));
  160. {$else m68k}
  161. {$ifdef powerpc}
  162. { place jump in codesegment }
  163. codesegment.concat(tai_align.create(4));
  164. codesegment.concat(tai_symbol.createname_global(hp2.name^,AT_FUNCTION,0));
  165. codesegment.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION)));
  166. codesegment.concat(tai_symbol_end.createname(hp2.name^));
  167. {$endif powerpc}
  168. {$else powerpc}
  169. {$error Exportliblinux.generatelib not yet implemented for target processor}
  170. {$endif m68k}
  171. {$endif i386}
  172. end;
  173. end
  174. else
  175. Message1(parser_e_no_export_of_variables_for_target,'linux');
  176. hp2:=texported_item(hp2.next);
  177. end;
  178. end;
  179. {*****************************************************************************
  180. TLINKERLINUX
  181. *****************************************************************************}
  182. Constructor TLinkerLinux.Create;
  183. begin
  184. Inherited Create;
  185. if NOT Dontlinkstdlibpath Then
  186. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
  187. end;
  188. procedure TLinkerLinux.SetDefaultInfo;
  189. {
  190. This will also detect which libc version will be used
  191. }
  192. {$ifdef m68k}
  193. var
  194. St : SearchRec;
  195. {$endif m68k}
  196. begin
  197. Glibc2:=false;
  198. Glibc21:=false;
  199. with Info do
  200. begin
  201. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
  202. DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
  203. DllCmd[2]:='strip --strip-unneeded $EXE';
  204. {$ifdef m68k}
  205. Glibc2:=true;
  206. FindFirst('/lib/ld*',AnyFile,st);
  207. while DosError=0 do
  208. begin
  209. if copy(st.name,1,5)='ld-2.' then
  210. begin
  211. DynamicLinker:='/lib/'+St.name;
  212. Glibc21:=st.name[6]<>'0';
  213. break;
  214. end;
  215. FindNext(St);
  216. end;
  217. FindClose(St);
  218. {$else m68k}
  219. {$ifdef i386}
  220. { first try glibc2 }
  221. DynamicLinker:='/lib/ld-linux.so.2';
  222. if FileExists(DynamicLinker) then
  223. begin
  224. Glibc2:=true;
  225. { Check for 2.0 files, else use the glibc 2.1 stub }
  226. if FileExists('/lib/ld-2.0.*') then
  227. Glibc21:=false
  228. else
  229. Glibc21:=true;
  230. end
  231. else
  232. DynamicLinker:='/lib/ld-linux.so.1';
  233. {$else i386}
  234. Glibc2 := true;
  235. DynamicLinker:='/lib/ld.so.1';
  236. {$endif i386}
  237. {$endif m68k}
  238. end;
  239. end;
  240. Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
  241. Var
  242. linkres : TLinkRes;
  243. i : longint;
  244. cprtobj,
  245. gprtobj,
  246. prtobj : string[80];
  247. HPath : TStringListItem;
  248. s,s1,s2 : string;
  249. found1,
  250. found2,
  251. linkdynamic,
  252. linklibc : boolean;
  253. begin
  254. WriteResponseFile:=False;
  255. { set special options for some targets }
  256. linkdynamic:=not(SharedLibFiles.empty);
  257. linklibc:=(SharedLibFiles.Find('c')<>nil);
  258. if isdll then
  259. begin
  260. prtobj:='dllprt0';
  261. cprtobj:='dllprt0';
  262. gprtobj:='dllprt0';
  263. end
  264. else
  265. begin
  266. prtobj:='prt0';
  267. cprtobj:='cprt0';
  268. gprtobj:='gprt0';
  269. if glibc21 then
  270. begin
  271. cprtobj:='cprt21';
  272. gprtobj:='gprt21';
  273. end;
  274. end;
  275. if cs_profile in aktmoduleswitches then
  276. begin
  277. prtobj:=gprtobj;
  278. if not glibc2 then
  279. AddSharedLibrary('gmon');
  280. AddSharedLibrary('c');
  281. linklibc:=true;
  282. end
  283. else
  284. begin
  285. if linklibc then
  286. prtobj:=cprtobj;
  287. end;
  288. { Open link.res file }
  289. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
  290. { Write path to search libraries }
  291. HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
  292. while assigned(HPath) do
  293. begin
  294. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  295. HPath:=TStringListItem(HPath.Next);
  296. end;
  297. HPath:=TStringListItem(LibrarySearchPath.First);
  298. while assigned(HPath) do
  299. begin
  300. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  301. HPath:=TStringListItem(HPath.Next);
  302. end;
  303. LinkRes.Add('INPUT(');
  304. { add objectfiles, start with prt0 always }
  305. if prtobj<>'' then
  306. LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
  307. { try to add crti and crtbegin if linking to C }
  308. if linklibc then
  309. begin
  310. if librarysearchpath.FindFile('crtbegin.o',s) then
  311. LinkRes.AddFileName(s);
  312. if librarysearchpath.FindFile('crti.o',s) then
  313. LinkRes.AddFileName(s);
  314. end;
  315. { main objectfiles }
  316. while not ObjectFiles.Empty do
  317. begin
  318. s:=ObjectFiles.GetFirst;
  319. if s<>'' then
  320. LinkRes.AddFileName(s);
  321. end;
  322. LinkRes.Add(')');
  323. { Write staticlibraries }
  324. if not StaticLibFiles.Empty then
  325. begin
  326. LinkRes.Add('GROUP(');
  327. While not StaticLibFiles.Empty do
  328. begin
  329. S:=StaticLibFiles.GetFirst;
  330. LinkRes.AddFileName(s)
  331. end;
  332. LinkRes.Add(')');
  333. end;
  334. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  335. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  336. if not SharedLibFiles.Empty then
  337. begin
  338. LinkRes.Add('INPUT(');
  339. While not SharedLibFiles.Empty do
  340. begin
  341. S:=SharedLibFiles.GetFirst;
  342. if s<>'c' then
  343. begin
  344. i:=Pos(target_info.sharedlibext,S);
  345. if i>0 then
  346. Delete(S,i,255);
  347. LinkRes.Add('-l'+s);
  348. end
  349. else
  350. begin
  351. linklibc:=true;
  352. linkdynamic:=false; { libc will include the ld-linux for us }
  353. end;
  354. end;
  355. { be sure that libc is the last lib }
  356. if linklibc then
  357. LinkRes.Add('-lc');
  358. { when we have -static for the linker the we also need libgcc }
  359. if (cs_link_staticflag in aktglobalswitches) then
  360. LinkRes.Add('-lgcc');
  361. if linkdynamic and (Info.DynamicLinker<>'') then
  362. LinkRes.AddFileName(Info.DynamicLinker);
  363. LinkRes.Add(')');
  364. end;
  365. { objects which must be at the end }
  366. if linklibc then
  367. begin
  368. found1:=librarysearchpath.FindFile('crtend.o',s1);
  369. found2:=librarysearchpath.FindFile('crtn.o',s2);
  370. if found1 or found2 then
  371. begin
  372. LinkRes.Add('INPUT(');
  373. if found1 then
  374. LinkRes.AddFileName(s1);
  375. if found2 then
  376. LinkRes.AddFileName(s2);
  377. LinkRes.Add(')');
  378. end;
  379. end;
  380. { Write and Close response }
  381. linkres.writetodisk;
  382. linkres.Free;
  383. WriteResponseFile:=True;
  384. end;
  385. function TLinkerLinux.MakeExecutable:boolean;
  386. var
  387. binstr,
  388. cmdstr : string;
  389. success : boolean;
  390. DynLinkStr : string[60];
  391. StaticStr,
  392. StripStr : string[40];
  393. begin
  394. if not(cs_link_extern in aktglobalswitches) then
  395. Message1(exec_i_linking,current_module.exefilename^);
  396. { Create some replacements }
  397. StaticStr:='';
  398. StripStr:='';
  399. DynLinkStr:='';
  400. if (cs_link_staticflag in aktglobalswitches) then
  401. StaticStr:='-static';
  402. if (cs_link_strip in aktglobalswitches) then
  403. StripStr:='-s';
  404. If (cs_profile in aktmoduleswitches) or
  405. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  406. begin
  407. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  408. if cshared Then
  409. DynLinkStr:='--shared ' + DynLinkStr;
  410. if rlinkpath<>'' Then
  411. DynLinkStr:='--rpath-link '+rlinkpath + ' '+ DynLinkStr;
  412. End;
  413. { Write used files and libraries }
  414. WriteResponseFile(false);
  415. { Call linker }
  416. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  417. Replace(cmdstr,'$EXE',current_module.exefilename^);
  418. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  419. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  420. Replace(cmdstr,'$STATIC',StaticStr);
  421. Replace(cmdstr,'$STRIP',StripStr);
  422. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  423. success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,false);
  424. { Remove ReponseFile }
  425. if (success) and not(cs_link_extern in aktglobalswitches) then
  426. RemoveFile(outputexedir+Info.ResName);
  427. MakeExecutable:=success; { otherwise a recursive call to link method }
  428. end;
  429. Function TLinkerLinux.MakeSharedLibrary:boolean;
  430. var
  431. InitStr,
  432. FiniStr,
  433. SoNameStr : string[80];
  434. binstr,
  435. cmdstr : string;
  436. success : boolean;
  437. begin
  438. MakeSharedLibrary:=false;
  439. if not(cs_link_extern in aktglobalswitches) then
  440. Message1(exec_i_linking,current_module.sharedlibfilename^);
  441. { Write used files and libraries }
  442. WriteResponseFile(true);
  443. { Create some replacements }
  444. InitStr:='-init FPC_LIB_START';
  445. FiniStr:='-fini FPC_LIB_EXIT';
  446. SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
  447. { Call linker }
  448. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  449. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  450. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  451. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  452. Replace(cmdstr,'$INIT',InitStr);
  453. Replace(cmdstr,'$FINI',FiniStr);
  454. Replace(cmdstr,'$SONAME',SoNameStr);
  455. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  456. { Strip the library ? }
  457. if success and (cs_link_strip in aktglobalswitches) then
  458. begin
  459. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  460. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  461. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  462. end;
  463. { Remove ReponseFile }
  464. if (success) and not(cs_link_extern in aktglobalswitches) then
  465. RemoveFile(outputexedir+Info.ResName);
  466. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  467. end;
  468. {*****************************************************************************
  469. Initialize
  470. *****************************************************************************}
  471. initialization
  472. {$ifdef i386}
  473. RegisterExternalLinker(system_i386_linux_info,TLinkerLinux);
  474. RegisterImport(system_i386_linux,timportliblinux);
  475. RegisterExport(system_i386_linux,texportliblinux);
  476. RegisterTarget(system_i386_linux_info);
  477. {$endif i386}
  478. {$ifdef m68k}
  479. RegisterExternalLinker(system_m68k_linux_info,TLinkerLinux);
  480. RegisterImport(system_m68k_linux,timportliblinux);
  481. RegisterExport(system_m68k_linux,texportliblinux);
  482. RegisterTarget(system_m68k_linux_info);
  483. {$endif m68k}
  484. {$ifdef powerpc}
  485. RegisterExternalLinker(system_powerpc_linux_info,TLinkerLinux);
  486. RegisterImport(system_powerpc_linux,timportliblinux);
  487. RegisterExport(system_powerpc_linux,texportliblinux);
  488. RegisterTarget(system_powerpc_linux_info);
  489. {$endif powerpc}
  490. {$ifdef alpha}
  491. RegisterExternalLinker(system_alpha_linux_info,TLinkerLinux);
  492. RegisterImport(system_alpha_linux,timportliblinux);
  493. RegisterExport(system_alpha_linux,texportliblinux);
  494. RegisterTarget(system_alpha_linux_info);
  495. {$endif alpha}
  496. {$ifdef x86_64}
  497. RegisterExternalLinker(system_x86_64_linux_info,TLinkerLinux);
  498. RegisterImport(system_x86_64_linux,timportliblinux);
  499. RegisterExport(system_x86_64_linux,texportliblinux);
  500. RegisterTarget(system_x86_64_linux_info);
  501. {$endif x86_64}
  502. {$ifdef SPARC}
  503. RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux);
  504. RegisterImport(system_SPARC_linux,timportliblinux);
  505. RegisterExport(system_SPARC_linux,texportliblinux);
  506. RegisterTarget(system_SPARC_linux_info);
  507. {$endif SPARC}
  508. {$ifdef ARM}
  509. RegisterExternalLinker(system_arm_linux_info,TLinkerLinux);
  510. RegisterImport(system_arm_linux,timportliblinux);
  511. RegisterExport(system_arm_linux,texportliblinux);
  512. RegisterTarget(system_arm_linux_info);
  513. {$endif ARM}
  514. end.
  515. {
  516. $Log$
  517. Revision 1.15 2004-03-02 00:36:33 olle
  518. * big transformation of Tai_[const_]Symbol.Create[data]name*
  519. Revision 1.14 2004/01/03 13:51:05 jonas
  520. + support exported procedures for linuxppc
  521. * refuse to compile systems/t_linux.pas if processor-specific support
  522. for exported procedures is absent
  523. + generate .type and .size info for all currently defined linux-variants
  524. in aggas.pas
  525. Revision 1.13 2004/01/01 15:34:50 jonas
  526. * default linker name for non-i386 and non-m68k
  527. Revision 1.12 2003/10/30 18:35:30 marco
  528. * librarysuffix + profiling
  529. Revision 1.11 2003/10/11 19:32:04 marco
  530. * -Xd
  531. Revision 1.10 2003/10/03 14:16:48 marco
  532. * -XP<prefix> support
  533. Revision 1.9 2003/07/21 11:52:57 florian
  534. * very basic stuff for the arm
  535. Revision 1.8 2003/04/27 07:29:52 peter
  536. * aktprocdef cleanup, aktprocdef is now always nil when parsing
  537. a new procdef declaration
  538. * aktprocsym removed
  539. * lexlevel removed, use symtable.symtablelevel instead
  540. * implicit init/final code uses the normal genentry/genexit
  541. * funcret state checking updated for new funcret handling
  542. Revision 1.7 2003/04/26 09:16:08 peter
  543. * .o files belonging to the unit are first searched in the same dir
  544. as the .ppu
  545. Revision 1.6 2002/12/14 13:02:45 carl
  546. - remove extra ifdef i386 (avoir compilation errors)
  547. Revision 1.5 2002/12/06 17:51:43 peter
  548. * m68k library support
  549. Revision 1.4 2002/11/17 16:32:04 carl
  550. * memory optimization (3-4%) : cleanup of tai fields,
  551. cleanup of tdef and tsym fields.
  552. * make it work for m68k
  553. Revision 1.3 2002/11/15 01:59:02 peter
  554. * merged changes from 1.0.7 up to 04-11
  555. - -V option for generating bug report tracing
  556. - more tracing for option parsing
  557. - errors for cdecl and high()
  558. - win32 import stabs
  559. - win32 records<=8 are returned in eax:edx (turned off by default)
  560. - heaptrc update
  561. - more info for temp management in .s file with EXTDEBUG
  562. Revision 1.2 2002/09/09 17:34:17 peter
  563. * tdicationary.replace added to replace and item in a dictionary. This
  564. is only allowed for the same name
  565. * varsyms are inserted in symtable before the types are parsed. This
  566. fixes the long standing "var longint : longint" bug
  567. - consume_idlist and idstringlist removed. The loops are inserted
  568. at the callers place and uses the symtable for duplicate id checking
  569. Revision 1.1 2002/09/06 15:03:51 carl
  570. * moved files to systems directory
  571. Revision 1.33 2002/09/03 16:26:28 daniel
  572. * Make Tprocdef.defs protected
  573. Revision 1.32 2002/08/12 15:08:44 carl
  574. + stab register indexes for powerpc (moved from gdb to cpubase)
  575. + tprocessor enumeration moved to cpuinfo
  576. + linker in target_info is now a class
  577. * many many updates for m68k (will soon start to compile)
  578. - removed some ifdef or correct them for correct cpu
  579. Revision 1.31 2002/08/11 14:32:32 peter
  580. * renamed current_library to objectlibrary
  581. Revision 1.30 2002/08/11 13:24:19 peter
  582. * saving of asmsymbols in ppu supported
  583. * asmsymbollist global is removed and moved into a new class
  584. tasmlibrarydata that will hold the info of a .a file which
  585. corresponds with a single module. Added librarydata to tmodule
  586. to keep the library info stored for the module. In the future the
  587. objectfiles will also be stored to the tasmlibrarydata class
  588. * all getlabel/newasmsymbol and friends are moved to the new class
  589. Revision 1.29 2002/07/26 21:15:46 florian
  590. * rewrote the system handling
  591. Revision 1.28 2002/07/04 20:43:02 florian
  592. * first x86-64 patches
  593. Revision 1.27 2002/07/01 18:46:35 peter
  594. * internal linker
  595. * reorganized aasm layer
  596. Revision 1.26 2002/05/18 13:34:26 peter
  597. * readded missing revisions
  598. Revision 1.25 2002/05/16 19:46:53 carl
  599. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  600. + try to fix temp allocation (still in ifdef)
  601. + generic constructor calls
  602. + start of tassembler / tmodulebase class cleanup
  603. Revision 1.22 2002/05/06 19:46:36 carl
  604. + added more patches from Mazen for SPARC port
  605. Revision 1.21 2002/04/22 18:19:22 carl
  606. - remove use_bound_instruction field
  607. Revision 1.20 2002/04/20 21:43:18 carl
  608. * fix stack size for some targets
  609. + add offset to parameters from frame pointer info.
  610. - remove some unused stuff
  611. Revision 1.19 2002/04/19 15:46:05 peter
  612. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  613. in most cases and not written to the ppu
  614. * add mangeledname_prefix() routine to generate the prefix of
  615. manglednames depending on the current procedure, object and module
  616. * removed static procprefix since the mangledname is now build only
  617. on demand from tprocdef.mangledname
  618. Revision 1.18 2002/04/15 19:44:23 peter
  619. * fixed stackcheck that would be called recursively when a stack
  620. error was found
  621. * generic changeregsize(reg,size) for i386 register resizing
  622. * removed some more routines from cga unit
  623. * fixed returnvalue handling
  624. * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
  625. Revision 1.17 2002/04/15 19:16:57 carl
  626. - remove size_of_pointer field
  627. Revision 1.16 2002/01/29 21:27:34 peter
  628. * default alignment changed to 4 bytes for locals and static const,var
  629. Revision 1.15 2002/01/09 07:38:37 michael
  630. + Patch from Peter for library imports
  631. }