t_linux.pas 25 KB

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