t_linux.pas 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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 defines.inc}
  21. interface
  22. uses
  23. import,export,link;
  24. type
  25. timportliblinux=class(timportlib)
  26. procedure preparelib(const s:string);override;
  27. procedure importprocedure(const func,module:string;index:longint;const name:string);override;
  28. procedure importvariable(const varname,module:string;const name:string);override;
  29. procedure generatelib;override;
  30. end;
  31. texportliblinux=class(texportlib)
  32. procedure preparelib(const s : string);override;
  33. procedure exportprocedure(hp : texported_item);override;
  34. procedure exportvar(hp : texported_item);override;
  35. procedure generatelib;override;
  36. end;
  37. tlinkerlinux=class(tlinker)
  38. private
  39. Glibc2,
  40. Glibc21 : boolean;
  41. Function WriteResponseFile(isdll:boolean) : Boolean;
  42. public
  43. constructor Create;override;
  44. procedure SetDefaultInfo;override;
  45. function MakeExecutable:boolean;override;
  46. function MakeSharedLibrary:boolean;override;
  47. end;
  48. implementation
  49. uses
  50. cutils,cclasses,
  51. verbose,systems,globtype,globals,
  52. symconst,script,
  53. fmodule,aasm,cpuasm,cpubase,symsym;
  54. {*****************************************************************************
  55. TIMPORTLIBLINUX
  56. *****************************************************************************}
  57. procedure timportliblinux.preparelib(const s : string);
  58. begin
  59. end;
  60. procedure timportliblinux.importprocedure(const func,module : string;index : longint;const name : string);
  61. begin
  62. { insert sharedlibrary }
  63. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  64. { do nothing with the procedure, only set the mangledname }
  65. if name<>'' then
  66. begin
  67. aktprocdef.setmangledname(name);
  68. aktprocdef.has_mangledname:=true;
  69. end
  70. else
  71. message(parser_e_empty_import_name);
  72. end;
  73. procedure timportliblinux.importvariable(const varname,module:string;const name:string);
  74. begin
  75. { insert sharedlibrary }
  76. current_module.linkothersharedlibs.add(SplitName(module),link_allways);
  77. { reset the mangledname and turn off the dll_var option }
  78. aktvarsym.set_mangledname(name);
  79. exclude(aktvarsym.varoptions,vo_is_dll_var);
  80. end;
  81. procedure timportliblinux.generatelib;
  82. begin
  83. end;
  84. {*****************************************************************************
  85. TEXPORTLIBLINUX
  86. *****************************************************************************}
  87. procedure texportliblinux.preparelib(const s:string);
  88. begin
  89. end;
  90. procedure texportliblinux.exportprocedure(hp : texported_item);
  91. var
  92. hp2 : texported_item;
  93. begin
  94. { first test the index value }
  95. if (hp.options and eo_index)<>0 then
  96. begin
  97. Message1(parser_e_no_export_with_index_for_target,'linux');
  98. exit;
  99. end;
  100. { now place in correct order }
  101. hp2:=texported_item(current_module._exports.first);
  102. while assigned(hp2) and
  103. (hp.name^>hp2.name^) do
  104. hp2:=texported_item(hp2.next);
  105. { insert hp there !! }
  106. if assigned(hp2) and (hp2.name^=hp.name^) then
  107. begin
  108. { this is not allowed !! }
  109. Message1(parser_e_export_name_double,hp.name^);
  110. exit;
  111. end;
  112. if hp2=texported_item(current_module._exports.first) then
  113. current_module._exports.concat(hp)
  114. else if assigned(hp2) then
  115. begin
  116. hp.next:=hp2;
  117. hp.previous:=hp2.previous;
  118. if assigned(hp2.previous) then
  119. hp2.previous.next:=hp;
  120. hp2.previous:=hp;
  121. end
  122. else
  123. current_module._exports.concat(hp);
  124. end;
  125. procedure texportliblinux.exportvar(hp : texported_item);
  126. begin
  127. hp.is_var:=true;
  128. exportprocedure(hp);
  129. end;
  130. procedure texportliblinux.generatelib;
  131. var
  132. hp2 : texported_item;
  133. begin
  134. hp2:=texported_item(current_module._exports.first);
  135. while assigned(hp2) do
  136. begin
  137. if (not hp2.is_var) and
  138. (hp2.sym.typ=procsym) then
  139. begin
  140. { the manglednames can already be the same when the procedure
  141. is declared with cdecl }
  142. if tprocsym(hp2.sym).defs^.def.mangledname<>hp2.name^ then
  143. begin
  144. {$ifdef i386}
  145. { place jump in codesegment }
  146. codesegment.concat(Tai_align.Create_op(4,$90));
  147. codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,0));
  148. codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,newasmsymbol(tprocsym(hp2.sym).defs^.def.mangledname)));
  149. codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
  150. {$endif i386}
  151. end;
  152. end
  153. else
  154. Message1(parser_e_no_export_of_variables_for_target,'linux');
  155. hp2:=texported_item(hp2.next);
  156. end;
  157. end;
  158. {*****************************************************************************
  159. TLINKERLINUX
  160. *****************************************************************************}
  161. Constructor TLinkerLinux.Create;
  162. begin
  163. Inherited Create;
  164. LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
  165. end;
  166. procedure TLinkerLinux.SetDefaultInfo;
  167. {
  168. This will also detect which libc version will be used
  169. }
  170. begin
  171. Glibc2:=false;
  172. Glibc21:=false;
  173. with Info do
  174. begin
  175. ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
  176. DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
  177. DllCmd[2]:='strip --strip-unneeded $EXE';
  178. { first try glibc2 }
  179. DynamicLinker:='/lib/ld-linux.so.2';
  180. if FileExists(DynamicLinker) then
  181. begin
  182. Glibc2:=true;
  183. { Check for 2.0 files, else use the glibc 2.1 stub }
  184. if FileExists('/lib/ld-2.0.*') then
  185. Glibc21:=false
  186. else
  187. Glibc21:=true;
  188. end
  189. else
  190. DynamicLinker:='/lib/ld-linux.so.1';
  191. end;
  192. end;
  193. Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
  194. Var
  195. linkres : TLinkRes;
  196. i : longint;
  197. cprtobj,
  198. gprtobj,
  199. prtobj : string[80];
  200. HPath : TStringListItem;
  201. s,s1,s2 : string;
  202. found1,
  203. found2,
  204. linkdynamic,
  205. linklibc : boolean;
  206. begin
  207. WriteResponseFile:=False;
  208. { set special options for some targets }
  209. linkdynamic:=not(SharedLibFiles.empty);
  210. linklibc:=(SharedLibFiles.Find('c')<>nil);
  211. if isdll then
  212. begin
  213. prtobj:='dllprt0';
  214. cprtobj:='dllprt0';
  215. gprtobj:='dllprt0';
  216. end
  217. else
  218. begin
  219. prtobj:='prt0';
  220. cprtobj:='cprt0';
  221. gprtobj:='gprt0';
  222. if glibc21 then
  223. begin
  224. cprtobj:='cprt21';
  225. gprtobj:='gprt21';
  226. end;
  227. end;
  228. if cs_profile in aktmoduleswitches then
  229. begin
  230. prtobj:=gprtobj;
  231. if not glibc2 then
  232. AddSharedLibrary('gmon');
  233. AddSharedLibrary('c');
  234. linklibc:=true;
  235. end
  236. else
  237. begin
  238. if linklibc then
  239. prtobj:=cprtobj;
  240. end;
  241. { Open link.res file }
  242. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
  243. { Write path to search libraries }
  244. HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
  245. while assigned(HPath) do
  246. begin
  247. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  248. HPath:=TStringListItem(HPath.Next);
  249. end;
  250. HPath:=TStringListItem(LibrarySearchPath.First);
  251. while assigned(HPath) do
  252. begin
  253. LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
  254. HPath:=TStringListItem(HPath.Next);
  255. end;
  256. LinkRes.Add('INPUT(');
  257. { add objectfiles, start with prt0 always }
  258. if prtobj<>'' then
  259. LinkRes.AddFileName(FindObjectFile(prtobj,''));
  260. { try to add crti and crtbegin if linking to C }
  261. if linklibc then
  262. begin
  263. if librarysearchpath.FindFile('crtbegin.o',s) then
  264. LinkRes.AddFileName(s);
  265. if librarysearchpath.FindFile('crti.o',s) then
  266. LinkRes.AddFileName(s);
  267. end;
  268. { main objectfiles }
  269. while not ObjectFiles.Empty do
  270. begin
  271. s:=ObjectFiles.GetFirst;
  272. if s<>'' then
  273. LinkRes.AddFileName(s);
  274. end;
  275. LinkRes.Add(')');
  276. { Write staticlibraries }
  277. if not StaticLibFiles.Empty then
  278. begin
  279. LinkRes.Add('GROUP(');
  280. While not StaticLibFiles.Empty do
  281. begin
  282. S:=StaticLibFiles.GetFirst;
  283. LinkRes.AddFileName(s)
  284. end;
  285. LinkRes.Add(')');
  286. end;
  287. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  288. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  289. if not SharedLibFiles.Empty then
  290. begin
  291. LinkRes.Add('INPUT(');
  292. While not SharedLibFiles.Empty do
  293. begin
  294. S:=SharedLibFiles.GetFirst;
  295. if s<>'c' then
  296. begin
  297. i:=Pos(target_info.sharedlibext,S);
  298. if i>0 then
  299. Delete(S,i,255);
  300. LinkRes.Add('-l'+s);
  301. end
  302. else
  303. begin
  304. linklibc:=true;
  305. linkdynamic:=false; { libc will include the ld-linux for us }
  306. end;
  307. end;
  308. { be sure that libc is the last lib }
  309. if linklibc then
  310. LinkRes.Add('-lc');
  311. { when we have -static for the linker the we also need libgcc }
  312. if (cs_link_staticflag in aktglobalswitches) then
  313. LinkRes.Add('-lgcc');
  314. if linkdynamic and (Info.DynamicLinker<>'') then
  315. LinkRes.AddFileName(Info.DynamicLinker);
  316. LinkRes.Add(')');
  317. end;
  318. { objects which must be at the end }
  319. if linklibc then
  320. begin
  321. found1:=librarysearchpath.FindFile('crtend.o',s1);
  322. found2:=librarysearchpath.FindFile('crtn.o',s2);
  323. if found1 or found2 then
  324. begin
  325. LinkRes.Add('INPUT(');
  326. if found1 then
  327. LinkRes.AddFileName(s1);
  328. if found2 then
  329. LinkRes.AddFileName(s2);
  330. LinkRes.Add(')');
  331. end;
  332. end;
  333. { Write and Close response }
  334. linkres.writetodisk;
  335. linkres.Free;
  336. WriteResponseFile:=True;
  337. end;
  338. function TLinkerLinux.MakeExecutable:boolean;
  339. var
  340. binstr,
  341. cmdstr : string;
  342. success : boolean;
  343. DynLinkStr : string[60];
  344. StaticStr,
  345. StripStr : string[40];
  346. begin
  347. if not(cs_link_extern in aktglobalswitches) then
  348. Message1(exec_i_linking,current_module.exefilename^);
  349. { Create some replacements }
  350. StaticStr:='';
  351. StripStr:='';
  352. DynLinkStr:='';
  353. if (cs_link_staticflag in aktglobalswitches) then
  354. StaticStr:='-static';
  355. if (cs_link_strip in aktglobalswitches) then
  356. StripStr:='-s';
  357. If (cs_profile in aktmoduleswitches) or
  358. ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
  359. DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
  360. { Write used files and libraries }
  361. WriteResponseFile(false);
  362. { Call linker }
  363. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  364. Replace(cmdstr,'$EXE',current_module.exefilename^);
  365. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  366. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  367. Replace(cmdstr,'$STATIC',StaticStr);
  368. Replace(cmdstr,'$STRIP',StripStr);
  369. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  370. success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
  371. { Remove ReponseFile }
  372. if (success) and not(cs_link_extern in aktglobalswitches) then
  373. RemoveFile(outputexedir+Info.ResName);
  374. MakeExecutable:=success; { otherwise a recursive call to link method }
  375. end;
  376. Function TLinkerLinux.MakeSharedLibrary:boolean;
  377. var
  378. InitStr,
  379. FiniStr,
  380. SoNameStr : string[80];
  381. binstr,
  382. cmdstr : string;
  383. success : boolean;
  384. begin
  385. MakeSharedLibrary:=false;
  386. if not(cs_link_extern in aktglobalswitches) then
  387. Message1(exec_i_linking,current_module.sharedlibfilename^);
  388. { Write used files and libraries }
  389. WriteResponseFile(true);
  390. { Create some replacements }
  391. InitStr:='-init FPC_LIB_START';
  392. FiniStr:='-fini FPC_LIB_EXIT';
  393. SoNameStr:='-soname '+SplitFileName(current_module.sharedlibfilename^);
  394. { Call linker }
  395. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  396. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  397. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  398. Replace(cmdstr,'$RES',outputexedir+Info.ResName);
  399. Replace(cmdstr,'$INIT',InitStr);
  400. Replace(cmdstr,'$FINI',FiniStr);
  401. Replace(cmdstr,'$SONAME',SoNameStr);
  402. success:=DoExec(FindUtil(binstr),cmdstr,true,false);
  403. { Strip the library ? }
  404. if success and (cs_link_strip in aktglobalswitches) then
  405. begin
  406. SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  407. Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
  408. success:=DoExec(FindUtil(binstr),cmdstr,true,false);
  409. end;
  410. { Remove ReponseFile }
  411. if (success) and not(cs_link_extern in aktglobalswitches) then
  412. RemoveFile(outputexedir+Info.ResName);
  413. MakeSharedLibrary:=success; { otherwise a recursive call to link method }
  414. end;
  415. {*****************************************************************************
  416. Initialize
  417. *****************************************************************************}
  418. {$ifdef i386}
  419. const
  420. target_i386_linux_info : ttargetinfo =
  421. (
  422. target : target_i386_LINUX;
  423. name : 'Linux for i386';
  424. shortname : 'Linux';
  425. flags : [];
  426. cpu : i386;
  427. unit_env : 'LINUXUNITS';
  428. extradefines : 'UNIX';
  429. sourceext : '.pp';
  430. pasext : '.pas';
  431. exeext : '';
  432. defext : '.def';
  433. scriptext : '.sh';
  434. smartext : '.sl';
  435. unitext : '.ppu';
  436. unitlibext : '.ppl';
  437. asmext : '.s';
  438. objext : '.o';
  439. resext : '.res';
  440. resobjext : '.or';
  441. sharedlibext : '.so';
  442. staticlibext : '.a';
  443. staticlibprefix : 'libp';
  444. sharedlibprefix : 'lib';
  445. sharedClibext : '.so';
  446. staticClibext : '.a';
  447. staticClibprefix : 'lib';
  448. sharedClibprefix : 'lib';
  449. Cprefix : '';
  450. newline : #10;
  451. dirsep : '/';
  452. files_case_relevent : true;
  453. assem : as_i386_elf32;
  454. assemextern : as_i386_as;
  455. link : ld_i386_linux;
  456. linkextern : ld_i386_linux;
  457. ar : ar_gnu_ar;
  458. res : res_none;
  459. script : script_unix;
  460. endian : endian_little;
  461. alignment :
  462. (
  463. procalign : 4;
  464. loopalign : 4;
  465. jumpalign : 0;
  466. constalignmin : 0;
  467. constalignmax : 4;
  468. varalignmin : 0;
  469. varalignmax : 4;
  470. localalignmin : 0;
  471. localalignmax : 4;
  472. paraalign : 4;
  473. recordalignmin : 0;
  474. recordalignmax : 2;
  475. maxCrecordalign : 4
  476. );
  477. size_of_longint : 4;
  478. heapsize : 256*1024;
  479. maxheapsize : 32*1024*1024;
  480. stacksize : 32*1024*1024;
  481. DllScanSupported:false;
  482. use_bound_instruction : false;
  483. use_function_relative_addresses : true
  484. );
  485. {$endif i386}
  486. {$ifdef m68k}
  487. const
  488. target_m68k_linux_info : ttargetinfo =
  489. (
  490. target : target_m68k_linux;
  491. name : 'Linux for m68k';
  492. shortname : 'linux';
  493. flags : [];
  494. cpu : m68k;
  495. short_name : 'LINUX';
  496. unit_env : 'LINUXUNITS';
  497. extradefines : 'UNIX';
  498. sourceext : '.pp';
  499. pasext : '.pas';
  500. exeext : '';
  501. defext : '';
  502. scriptext : '.sh';
  503. smartext : '.sl';
  504. unitext : '.ppu';
  505. unitlibext : '.ppl';
  506. asmext : '.s';
  507. objext : '.o';
  508. resext : '.res';
  509. resobjext : '.or';
  510. sharedlibext : '.so';
  511. staticlibext : '.a';
  512. staticlibprefix : 'libp';
  513. sharedlibprefix : 'lib';
  514. sharedClibext : '.so';
  515. staticClibext : '.a';
  516. staticClibprefix : 'lib';
  517. sharedClibprefix : 'lib';
  518. Cprefix : '';
  519. newline : #10;
  520. dirsep : '/';
  521. files_case_relevent : true;
  522. assem : as_m68k_as;
  523. assemextern : as_m68k_as;
  524. link : ld_m68k_linux;
  525. linkextern : ld_m68k_linux;
  526. ar : ar_m68k_ar;
  527. res : res_none;
  528. script : script_unix;
  529. endian : endian_big;
  530. stackalignment : 2;
  531. maxCrecordalignment : 32;
  532. size_of_longint : 4;
  533. heapsize : 128*1024;
  534. maxheapsize : 32*1024*1024;
  535. stacksize : 32*1024*1024;
  536. DllScanSupported:false;
  537. use_bound_instruction : false;
  538. use_function_relative_addresses : true
  539. );
  540. {$endif m68k}
  541. {$ifdef powerpc}
  542. const
  543. target_powerpc_linux_info : ttargetinfo =
  544. (
  545. target : target_powerpc_LINUX;
  546. name : 'Linux for PowerPC';
  547. shortname : 'linuxppc';
  548. flags : [];
  549. cpu : powerpc;
  550. short_name : 'LINUX';
  551. unit_env : '';
  552. extradefines : 'UNIX';
  553. sourceext : '.pp';
  554. pasext : '.pas';
  555. exeext : '';
  556. defext : '.def';
  557. scriptext : '.sh';
  558. smartext : '.sl';
  559. unitext : '.ppu';
  560. unitlibext : '.ppl';
  561. asmext : '.s';
  562. objext : '.o';
  563. resext : '.res';
  564. resobjext : '.or';
  565. sharedlibext : '.so';
  566. staticlibext : '.s';
  567. staticlibprefix : 'libp';
  568. sharedlibprefix : 'lib';
  569. sharedClibext : '.so';
  570. staticClibext : '.a';
  571. staticClibprefix : 'lib';
  572. sharedClibprefix : 'lib';
  573. Cprefix : '';
  574. newline : #10;
  575. dirsep : '/';
  576. files_case_relevent : true;
  577. assem : as_powerpc_as;
  578. assemsrc : as_powerpc_as;
  579. ar : ar_powerpc_ar;
  580. res : res_none;
  581. script : script_unix;
  582. endian : endian_big;
  583. stackalignment : 8;
  584. maxCrecordalignment : 32;
  585. size_of_longint : 4;
  586. heapsize : 256*1024;
  587. maxheapsize : 32*1024*1024;
  588. stacksize : 32*1024*1024;
  589. DllScanSupported:false;
  590. use_bound_instruction : false;
  591. use_function_relative_addresses : true
  592. );
  593. {$endif powerpc}
  594. {$ifdef alpha}
  595. const
  596. target_alpha_linux_info : ttargetinfo =
  597. (
  598. target : target_alpha_LINUX;
  599. name : 'Linux for Alpha';
  600. shortname : 'axplinux';
  601. flags : [];
  602. cpu : alpha;
  603. short_name : 'LINUX';
  604. unit_env : 'LINUXUNITS';
  605. extradefines : 'UNIX';
  606. sourceext : '.pp';
  607. pasext : '.pas';
  608. exeext : '';
  609. defext : '.def';
  610. scriptext : '.sh';
  611. smartext : '.sl';
  612. unitext : '.ppu';
  613. unitlibext : '.ppl';
  614. asmext : '.s';
  615. objext : '.o';
  616. resext : '.res';
  617. resobjext : '.or';
  618. sharedlibext : '.so';
  619. staticlibext : '.a';
  620. staticlibprefix : 'libp';
  621. sharedlibprefix : 'lib';
  622. sharedClibext : '.so';
  623. staticClibext : '.a';
  624. staticClibprefix : 'lib';
  625. sharedClibprefix : 'lib';
  626. Cprefix : '';
  627. newline : #10;
  628. dirsep : '/';
  629. files_case_relevent : true;
  630. assem : as_alpha_as;
  631. assemextern : as_alpha_as;
  632. link : ld_alpha_linux;
  633. linkextern : ld_alpha_linux;
  634. ar : ar_alpha_ar;
  635. res : res_none;
  636. script : script_unix;
  637. endian : endian_little;
  638. stackalignment : 8;
  639. maxCrecordalignment : 32;
  640. size_of_longint : 4;
  641. heapsize : 256*1024;
  642. maxheapsize : 32*1024*1024;
  643. stacksize : 32*1024*1024;
  644. DllScanSupported:false;
  645. use_bound_instruction : false;
  646. use_function_relative_addresses : true
  647. );
  648. {$endif alpha}
  649. initialization
  650. {$ifdef i386}
  651. RegisterLinker(ld_i386_linux,TLinkerLinux);
  652. RegisterImport(target_i386_linux,timportliblinux);
  653. RegisterExport(target_i386_linux,texportliblinux);
  654. RegisterTarget(target_i386_linux_info);
  655. {$endif i386}
  656. {$ifdef m68k}
  657. RegisterLinker(ld_m68k_linux,TLinkerLinux);
  658. RegisterImport(target_m68k_linux,timportliblinux);
  659. RegisterExport(target_m68k_linux,texportliblinux);
  660. RegisterTarget(target_m68k_linux_info);
  661. {$endif m68k}
  662. {$ifdef powerpc}
  663. RegisterLinker(ld_powerpc_linux,TLinkerLinux);
  664. RegisterImport(target_powerpc_linux,timportliblinux);
  665. RegisterExport(target_powerpc_linux,texportliblinux);
  666. RegisterTarget(target_powerpc_linux_info);
  667. {$endif powerpc}
  668. {$ifdef alpha}
  669. RegisterLinker(ld_alpha_linux,TLinkerLinux);
  670. RegisterImport(target_alpha_linux,timportliblinux);
  671. RegisterExport(target_alpha_linux,texportliblinux);
  672. RegisterTarget(target_alpha_linux_info);
  673. {$endif alpha}
  674. end.
  675. {
  676. $Log$
  677. Revision 1.19 2002-04-19 15:46:05 peter
  678. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  679. in most cases and not written to the ppu
  680. * add mangeledname_prefix() routine to generate the prefix of
  681. manglednames depending on the current procedure, object and module
  682. * removed static procprefix since the mangledname is now build only
  683. on demand from tprocdef.mangledname
  684. Revision 1.18 2002/04/15 19:44:23 peter
  685. * fixed stackcheck that would be called recursively when a stack
  686. error was found
  687. * generic changeregsize(reg,size) for i386 register resizing
  688. * removed some more routines from cga unit
  689. * fixed returnvalue handling
  690. * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
  691. Revision 1.17 2002/04/15 19:16:57 carl
  692. - remove size_of_pointer field
  693. Revision 1.16 2002/01/29 21:27:34 peter
  694. * default alignment changed to 4 bytes for locals and static const,var
  695. Revision 1.15 2002/01/09 07:38:37 michael
  696. + Patch from Peter for library imports
  697. Revision 1.14 2001/11/02 22:58:12 peter
  698. * procsym definition rewrite
  699. Revision 1.13 2001/09/18 11:32:00 michael
  700. * Fixes win32 linking problems with import libraries
  701. * LINKLIB Libraries are now looked for using C file extensions
  702. * get_exepath fix
  703. Revision 1.12 2001/09/17 21:29:16 peter
  704. * merged netbsd, fpu-overflow from fixes branch
  705. Revision 1.11 2001/08/07 18:47:15 peter
  706. * merged netbsd start
  707. * profile for win32
  708. Revision 1.10 2001/07/01 20:16:20 peter
  709. * alignmentinfo record added
  710. * -Oa argument supports more alignment settings that can be specified
  711. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  712. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  713. required alignment and the maximum usefull alignment. The final
  714. alignment will be choosen per variable size dependent on these
  715. settings
  716. Revision 1.9 2001/06/28 19:46:25 peter
  717. * added override and virtual for constructors
  718. Revision 1.8 2001/06/04 11:51:06 peter
  719. * C linking fixed
  720. Revision 1.7 2001/06/03 15:15:31 peter
  721. * dllprt0 stub for linux shared libs
  722. * pass -init and -fini for linux shared libs
  723. * libprefix splitted into staticlibprefix and sharedlibprefix
  724. Revision 1.6 2001/06/02 19:22:44 peter
  725. * extradefines field added
  726. Revision 1.5 2001/04/21 15:34:01 peter
  727. * fixed writing of end objects to not output an empty INPUT()
  728. Revision 1.4 2001/04/18 22:02:04 peter
  729. * registration of targets and assemblers
  730. Revision 1.3 2001/04/13 01:22:21 peter
  731. * symtable change to classes
  732. * range check generation and errors fixed, make cycle DEBUG=1 works
  733. * memory leaks fixed
  734. Revision 1.2 2001/03/22 10:08:12 michael
  735. + .ctor patch merged from fixbranch
  736. Revision 1.1 2001/02/26 19:43:11 peter
  737. * moved target units to subdir
  738. Revision 1.11 2001/02/20 21:41:17 peter
  739. * new fixfilename, findfile for unix. Look first for lowercase, then
  740. NormalCase and last for UPPERCASE names.
  741. Revision 1.10 2000/12/30 22:53:25 peter
  742. * export with the case provided in the exports section
  743. Revision 1.9 2000/12/25 00:07:30 peter
  744. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  745. tlinkedlist objects)
  746. Revision 1.8 2000/10/31 22:02:54 peter
  747. * symtable splitted, no real code changes
  748. Revision 1.7 2000/09/24 21:33:47 peter
  749. * message updates merges
  750. Revision 1.6 2000/09/24 15:06:31 peter
  751. * use defines.inc
  752. Revision 1.5 2000/09/10 20:26:55 peter
  753. * bsd patches from marco
  754. Revision 1.4 2000/08/27 16:11:54 peter
  755. * moved some util functions from globals,cobjects to cutils
  756. * splitted files into finput,fmodule
  757. Revision 1.3 2000/07/13 12:08:28 michael
  758. + patched to 1.1.0 with former 1.09patch from peter
  759. Revision 1.2 2000/07/13 11:32:50 michael
  760. + removed logs
  761. }