t_linux.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  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.setmangledname(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_pointer : 4;
  478. size_of_longint : 4;
  479. heapsize : 256*1024;
  480. maxheapsize : 32768*1024;
  481. stacksize : 8192;
  482. DllScanSupported:false;
  483. use_bound_instruction : false;
  484. use_function_relative_addresses : true
  485. );
  486. {$endif i386}
  487. {$ifdef m68k}
  488. const
  489. target_m68k_linux_info : ttargetinfo =
  490. (
  491. target : target_m68k_linux;
  492. name : 'Linux for m68k';
  493. shortname : 'linux';
  494. flags : [];
  495. cpu : m68k;
  496. short_name : 'LINUX';
  497. unit_env : 'LINUXUNITS';
  498. extradefines : 'UNIX';
  499. sourceext : '.pp';
  500. pasext : '.pas';
  501. exeext : '';
  502. defext : '';
  503. scriptext : '.sh';
  504. smartext : '.sl';
  505. unitext : '.ppu';
  506. unitlibext : '.ppl';
  507. asmext : '.s';
  508. objext : '.o';
  509. resext : '.res';
  510. resobjext : '.or';
  511. sharedlibext : '.so';
  512. staticlibext : '.a';
  513. staticlibprefix : 'libp';
  514. sharedlibprefix : 'lib';
  515. sharedClibext : '.so';
  516. staticClibext : '.a';
  517. staticClibprefix : 'lib';
  518. sharedClibprefix : 'lib';
  519. Cprefix : '';
  520. newline : #10;
  521. dirsep : '/';
  522. files_case_relevent : true;
  523. assem : as_m68k_as;
  524. assemextern : as_m68k_as;
  525. link : ld_m68k_linux;
  526. linkextern : ld_m68k_linux;
  527. ar : ar_m68k_ar;
  528. res : res_none;
  529. script : script_unix;
  530. endian : endian_big;
  531. stackalignment : 2;
  532. maxCrecordalignment : 32;
  533. size_of_pointer : 4;
  534. size_of_longint : 4;
  535. heapsize : 128*1024;
  536. maxheapsize : 32768*1024;
  537. stacksize : 8192;
  538. DllScanSupported:false;
  539. use_bound_instruction : false;
  540. use_function_relative_addresses : true
  541. );
  542. {$endif m68k}
  543. {$ifdef powerpc}
  544. const
  545. target_powerpc_linux_info : ttargetinfo =
  546. (
  547. target : target_powerpc_LINUX;
  548. name : 'Linux for PowerPC';
  549. shortname : 'linuxppc';
  550. flags : [];
  551. cpu : powerpc;
  552. short_name : 'LINUX';
  553. unit_env : '';
  554. extradefines : 'UNIX';
  555. sourceext : '.pp';
  556. pasext : '.pas';
  557. exeext : '';
  558. defext : '.def';
  559. scriptext : '.sh';
  560. smartext : '.sl';
  561. unitext : '.ppu';
  562. unitlibext : '.ppl';
  563. asmext : '.s';
  564. objext : '.o';
  565. resext : '.res';
  566. resobjext : '.or';
  567. sharedlibext : '.so';
  568. staticlibext : '.s';
  569. staticlibprefix : 'libp';
  570. sharedlibprefix : 'lib';
  571. sharedClibext : '.so';
  572. staticClibext : '.a';
  573. staticClibprefix : 'lib';
  574. sharedClibprefix : 'lib';
  575. Cprefix : '';
  576. newline : #10;
  577. dirsep : '/';
  578. files_case_relevent : true;
  579. assem : as_powerpc_as;
  580. assemsrc : as_powerpc_as;
  581. ar : ar_powerpc_ar;
  582. res : res_none;
  583. script : script_unix;
  584. endian : endian_big;
  585. stackalignment : 8;
  586. maxCrecordalignment : 32;
  587. size_of_pointer : 4;
  588. size_of_longint : 4;
  589. heapsize : 256*1024;
  590. maxheapsize : 32768*1024;
  591. stacksize : 8192;
  592. DllScanSupported:false;
  593. use_bound_instruction : false;
  594. use_function_relative_addresses : true
  595. );
  596. {$endif powerpc}
  597. {$ifdef alpha}
  598. const
  599. target_alpha_linux_info : ttargetinfo =
  600. (
  601. target : target_alpha_LINUX;
  602. name : 'Linux for Alpha';
  603. shortname : 'axplinux';
  604. flags : [];
  605. cpu : alpha;
  606. short_name : 'LINUX';
  607. unit_env : 'LINUXUNITS';
  608. extradefines : 'UNIX';
  609. sourceext : '.pp';
  610. pasext : '.pas';
  611. exeext : '';
  612. defext : '.def';
  613. scriptext : '.sh';
  614. smartext : '.sl';
  615. unitext : '.ppu';
  616. unitlibext : '.ppl';
  617. asmext : '.s';
  618. objext : '.o';
  619. resext : '.res';
  620. resobjext : '.or';
  621. sharedlibext : '.so';
  622. staticlibext : '.a';
  623. staticlibprefix : 'libp';
  624. sharedlibprefix : 'lib';
  625. sharedClibext : '.so';
  626. staticClibext : '.a';
  627. staticClibprefix : 'lib';
  628. sharedClibprefix : 'lib';
  629. Cprefix : '';
  630. newline : #10;
  631. dirsep : '/';
  632. files_case_relevent : true;
  633. assem : as_alpha_as;
  634. assemextern : as_alpha_as;
  635. link : ld_alpha_linux;
  636. linkextern : ld_alpha_linux;
  637. ar : ar_alpha_ar;
  638. res : res_none;
  639. script : script_unix;
  640. endian : endian_little;
  641. stackalignment : 8;
  642. maxCrecordalignment : 32;
  643. size_of_pointer : 8;
  644. size_of_longint : 4;
  645. heapsize : 256*1024;
  646. maxheapsize : 32768*1024;
  647. stacksize : 8192;
  648. DllScanSupported:false;
  649. use_bound_instruction : false;
  650. use_function_relative_addresses : true
  651. );
  652. {$endif alpha}
  653. initialization
  654. {$ifdef i386}
  655. RegisterLinker(ld_i386_linux,TLinkerLinux);
  656. RegisterImport(target_i386_linux,timportliblinux);
  657. RegisterExport(target_i386_linux,texportliblinux);
  658. RegisterTarget(target_i386_linux_info);
  659. {$endif i386}
  660. {$ifdef m68k}
  661. RegisterLinker(ld_m68k_linux,TLinkerLinux);
  662. RegisterImport(target_m68k_linux,timportliblinux);
  663. RegisterExport(target_m68k_linux,texportliblinux);
  664. RegisterTarget(target_m68k_linux_info);
  665. {$endif m68k}
  666. {$ifdef powerpc}
  667. RegisterLinker(ld_powerpc_linux,TLinkerLinux);
  668. RegisterImport(target_powerpc_linux,timportliblinux);
  669. RegisterExport(target_powerpc_linux,texportliblinux);
  670. RegisterTarget(target_powerpc_linux_info);
  671. {$endif powerpc}
  672. {$ifdef alpha}
  673. RegisterLinker(ld_alpha_linux,TLinkerLinux);
  674. RegisterImport(target_alpha_linux,timportliblinux);
  675. RegisterExport(target_alpha_linux,texportliblinux);
  676. RegisterTarget(target_alpha_linux_info);
  677. {$endif alpha}
  678. end.
  679. {
  680. $Log$
  681. Revision 1.16 2002-01-29 21:27:34 peter
  682. * default alignment changed to 4 bytes for locals and static const,var
  683. Revision 1.15 2002/01/09 07:38:37 michael
  684. + Patch from Peter for library imports
  685. Revision 1.14 2001/11/02 22:58:12 peter
  686. * procsym definition rewrite
  687. Revision 1.13 2001/09/18 11:32:00 michael
  688. * Fixes win32 linking problems with import libraries
  689. * LINKLIB Libraries are now looked for using C file extensions
  690. * get_exepath fix
  691. Revision 1.12 2001/09/17 21:29:16 peter
  692. * merged netbsd, fpu-overflow from fixes branch
  693. Revision 1.11 2001/08/07 18:47:15 peter
  694. * merged netbsd start
  695. * profile for win32
  696. Revision 1.10 2001/07/01 20:16:20 peter
  697. * alignmentinfo record added
  698. * -Oa argument supports more alignment settings that can be specified
  699. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  700. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  701. required alignment and the maximum usefull alignment. The final
  702. alignment will be choosen per variable size dependent on these
  703. settings
  704. Revision 1.9 2001/06/28 19:46:25 peter
  705. * added override and virtual for constructors
  706. Revision 1.8 2001/06/04 11:51:06 peter
  707. * C linking fixed
  708. Revision 1.7 2001/06/03 15:15:31 peter
  709. * dllprt0 stub for linux shared libs
  710. * pass -init and -fini for linux shared libs
  711. * libprefix splitted into staticlibprefix and sharedlibprefix
  712. Revision 1.6 2001/06/02 19:22:44 peter
  713. * extradefines field added
  714. Revision 1.5 2001/04/21 15:34:01 peter
  715. * fixed writing of end objects to not output an empty INPUT()
  716. Revision 1.4 2001/04/18 22:02:04 peter
  717. * registration of targets and assemblers
  718. Revision 1.3 2001/04/13 01:22:21 peter
  719. * symtable change to classes
  720. * range check generation and errors fixed, make cycle DEBUG=1 works
  721. * memory leaks fixed
  722. Revision 1.2 2001/03/22 10:08:12 michael
  723. + .ctor patch merged from fixbranch
  724. Revision 1.1 2001/02/26 19:43:11 peter
  725. * moved target units to subdir
  726. Revision 1.11 2001/02/20 21:41:17 peter
  727. * new fixfilename, findfile for unix. Look first for lowercase, then
  728. NormalCase and last for UPPERCASE names.
  729. Revision 1.10 2000/12/30 22:53:25 peter
  730. * export with the case provided in the exports section
  731. Revision 1.9 2000/12/25 00:07:30 peter
  732. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  733. tlinkedlist objects)
  734. Revision 1.8 2000/10/31 22:02:54 peter
  735. * symtable splitted, no real code changes
  736. Revision 1.7 2000/09/24 21:33:47 peter
  737. * message updates merges
  738. Revision 1.6 2000/09/24 15:06:31 peter
  739. * use defines.inc
  740. Revision 1.5 2000/09/10 20:26:55 peter
  741. * bsd patches from marco
  742. Revision 1.4 2000/08/27 16:11:54 peter
  743. * moved some util functions from globals,cobjects to cutils
  744. * splitted files into finput,fmodule
  745. Revision 1.3 2000/07/13 12:08:28 michael
  746. + patched to 1.1.0 with former 1.09patch from peter
  747. Revision 1.2 2000/07/13 11:32:50 michael
  748. + removed logs
  749. }