link.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858
  1. {
  2. $Id$
  3. Copyright (c) 1998 by the FPC development team
  4. This unit handles the linker and binder calls for programs and
  5. libraries
  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 link;
  20. Interface
  21. { Needed for LFN support in path to the executable }
  22. {$ifdef GO32V2}
  23. {$define ALWAYSSHELL}
  24. {$endif}
  25. uses cobjects,files;
  26. Type
  27. TLinker = Object
  28. Glibc2,
  29. Glibc21,
  30. LinkToC, { Should we link to the C libs? }
  31. Strip : Boolean; { Strip symbols ? }
  32. ObjectFiles,
  33. SharedLibFiles,
  34. StaticLibFiles : TStringContainer;
  35. LibrarySearchPath, { Search path for libraries }
  36. LinkOptions : string; { Additional options to the linker }
  37. DynamicLinker : String[80]; { What Dynamic linker ? }
  38. LinkResName : String[32]; { Name of response file }
  39. { Methods }
  40. Constructor Init;
  41. Destructor Done;
  42. procedure AddModuleFiles(hp:pmodule);
  43. function FindObjectFile(s : string) : string;
  44. function FindLibraryFile(s:string;const ext:string) : string;
  45. Procedure AddObject(const S : String);
  46. Procedure AddStaticLibrary(const S : String);
  47. Procedure AddSharedLibrary(S : String);
  48. Function FindLinker:String; { Find linker, sets Name }
  49. Function DoExec(const command,para:string;info,useshell:boolean):boolean;
  50. Function WriteResponseFile:Boolean;
  51. Function MakeExecutable:boolean;
  52. Procedure MakeStaticLibrary(filescnt:longint);
  53. Procedure MakeSharedLibrary;
  54. end;
  55. PLinker=^TLinker;
  56. Var
  57. Linker : TLinker;
  58. Implementation
  59. uses
  60. {$ifdef Delphi}
  61. dmisc,
  62. {$endif Delphi}
  63. globtype,systems,
  64. script,globals,verbose
  65. {$ifdef i386}
  66. ,win_targ
  67. {$endif}
  68. {$ifdef linux}
  69. ,linux
  70. {$endif}
  71. ,dos
  72. ;
  73. {$ifndef linux}
  74. Procedure Shell(const command:string);
  75. { This is already defined in the linux.ppu for linux, need for the *
  76. expansion under linux }
  77. var
  78. comspec : string;
  79. begin
  80. comspec:=getenv('COMSPEC');
  81. Exec(comspec,' /C '+command);
  82. end;
  83. {$endif}
  84. Constructor TLinker.Init;
  85. begin
  86. ObjectFiles.Init_no_double;
  87. SharedLibFiles.Init_no_double;
  88. StaticLibFiles.Init_no_double;
  89. LinkToC:=False;
  90. Glibc2:=false;
  91. Glibc21:=false;
  92. Strip:=false;
  93. LinkOptions:='';
  94. {$ifdef linux}
  95. { first try glibc2 }
  96. DynamicLinker:='/lib/ld-linux.so.2';
  97. if FileExists(DynamicLinker) then
  98. begin
  99. Glibc2:=true;
  100. { also glibc 2.1 / 2.1.1 ? }
  101. if FileExists('/lib/ld-2.1.so') or
  102. FileExists('/lib/ld-2.1.1.so') then
  103. Glibc21:=true;
  104. end
  105. else
  106. DynamicLinker:='/lib/ld-linux.so.1';
  107. LibrarySearchPath:='/lib;/usr/lib;/usr/X11R6/lib';
  108. {$else}
  109. DynamicLinker:='';
  110. LibrarySearchPath:='';
  111. {$endif}
  112. LinkResName:='link.res';
  113. end;
  114. Destructor TLinker.Done;
  115. begin
  116. ObjectFiles.Done;
  117. SharedLibFiles.Done;
  118. StaticLibFiles.Done;
  119. end;
  120. procedure TLinker.AddModuleFiles(hp:pmodule);
  121. begin
  122. with hp^ do
  123. begin
  124. while not linkunitfiles.empty do
  125. AddObject(linkunitfiles.Get);
  126. while not linkofiles.empty do
  127. AddObject(linkofiles.Get);
  128. while not linksharedlibs.empty do
  129. AddSharedLibrary(linksharedlibs.Get);
  130. while not linkstaticlibs.empty do
  131. AddStaticLibrary(linkstaticlibs.Get);
  132. end;
  133. end;
  134. var
  135. LastLDBin : string;
  136. Function TLinker.FindLinker:string;
  137. var
  138. ldfound : boolean;
  139. begin
  140. if LastLDBin='' then
  141. begin
  142. if utilsdirectory<>'' then
  143. LastLDBin:=Search(target_link.linkbin+source_os.exeext,utilsdirectory,ldfound)+
  144. target_link.linkbin+source_os.exeext;
  145. if LastLDBin='' then
  146. LastLDBin:=FindExe(target_link.linkbin,ldfound);
  147. if (not ldfound) and not(cs_link_extern in aktglobalswitches) then
  148. begin
  149. Message1(exec_w_linker_not_found,LastLDBin);
  150. aktglobalswitches:=aktglobalswitches+[cs_link_extern];
  151. end;
  152. if ldfound then
  153. Message1(exec_t_using_linker,LastLDBin);
  154. end;
  155. FindLinker:=LastLDBin;
  156. end;
  157. { searches an object file }
  158. function TLinker.FindObjectFile(s:string) : string;
  159. var
  160. found : boolean;
  161. begin
  162. if pos('.',s)=0 then
  163. s:=s+target_info.objext;
  164. s:=FixFileName(s);
  165. if FileExists(s) then
  166. begin
  167. Findobjectfile:=s;
  168. exit;
  169. end;
  170. { find object file
  171. 1. cwd
  172. 2. unit search path
  173. 3. local object path
  174. 4. global object path
  175. 5. exepath }
  176. found:=false;
  177. findobjectfile:=search(s,'.',found)+s;
  178. if (not found) then
  179. findobjectfile:=search(s,unitsearchpath,found)+s;
  180. if (not found) and assigned(current_module^.localobjectsearchpath) then
  181. findobjectfile:=search(s,current_module^.localobjectsearchpath^,found)+s;
  182. if (not found) then
  183. findobjectfile:=search(s,objectsearchpath,found)+s;
  184. if (not found) then
  185. findobjectfile:=search(s,exepath,found)+s;
  186. if not(cs_link_extern in aktglobalswitches) and (not found) then
  187. Message1(exec_w_objfile_not_found,s);
  188. end;
  189. { searches an library file }
  190. function TLinker.FindLibraryFile(s:string;const ext:string) : string;
  191. var
  192. found : boolean;
  193. begin
  194. if pos('.',s)=0 then
  195. s:=s+ext;
  196. if FileExists(s) then
  197. begin
  198. FindLibraryFile:=s;
  199. exit;
  200. end;
  201. { find libary
  202. 1. cwd
  203. 2. local libary dir
  204. 3. global libary dir
  205. 4. exe path of the compiler }
  206. found:=false;
  207. findlibraryfile:=search(s,'.',found)+s;
  208. if (not found) and assigned(current_module^.locallibrarysearchpath) then
  209. findlibraryfile:=search(s,current_module^.locallibrarysearchpath^,found)+s;
  210. if (not found) then
  211. findlibraryfile:=search(s,librarysearchpath,found)+s;
  212. if (not found) then
  213. findlibraryfile:=search(s,exepath,found)+s;
  214. if not(cs_link_extern in aktglobalswitches) and (not found) then
  215. Message1(exec_w_libfile_not_found,s);
  216. end;
  217. Procedure TLinker.AddObject(const S : String);
  218. begin
  219. ObjectFiles.Insert(FindObjectFile(s));
  220. end;
  221. Procedure TLinker.AddSharedLibrary(S:String);
  222. begin
  223. { remove prefix 'lib' }
  224. if Copy(s,1,length(target_os.libprefix))=target_os.libprefix then
  225. Delete(s,1,length(target_os.libprefix));
  226. { remove extension if any }
  227. if Copy(s,length(s)-length(target_os.sharedlibext)+1,length(target_os.sharedlibext))=target_os.sharedlibext then
  228. Delete(s,length(s)-length(target_os.sharedlibext)+1,length(target_os.sharedlibext)+1);
  229. { ready to be inserted }
  230. SharedLibFiles.Insert (S);
  231. end;
  232. Procedure TLinker.AddStaticLibrary(const S:String);
  233. begin
  234. StaticLibFiles.Insert(FindLibraryFile(s,target_os.staticlibext));
  235. end;
  236. Function TLinker.DoExec(const command,para:string;info,useshell:boolean):boolean;
  237. begin
  238. DoExec:=true;
  239. if not(cs_link_extern in aktglobalswitches) then
  240. begin
  241. swapvectors;
  242. {$ifdef ALWAYSSHELL}
  243. shell(command+' '+para);
  244. {$else}
  245. if useshell then
  246. shell(command+' '+para)
  247. else
  248. exec(command,para);
  249. {$endif}
  250. swapvectors;
  251. if (doserror<>0) then
  252. begin
  253. Message(exec_w_cant_call_linker);
  254. aktglobalswitches:=aktglobalswitches+[cs_link_extern];
  255. DoExec:=false;
  256. end
  257. else
  258. if (dosexitcode<>0) then
  259. begin
  260. Message(exec_w_error_while_linking);
  261. aktglobalswitches:=aktglobalswitches+[cs_link_extern];
  262. DoExec:=false;
  263. end;
  264. end;
  265. { Update asmres when externmode is set }
  266. if cs_link_extern in aktglobalswitches then
  267. begin
  268. if info then
  269. AsmRes.AddLinkCommand(Command,Para,current_module^.exefilename^)
  270. else
  271. AsmRes.AddLinkCommand(Command,Para,'');
  272. end;
  273. end;
  274. Function TLinker.WriteResponseFile : Boolean;
  275. Var
  276. LinkResponse : Text;
  277. i : longint;
  278. cprtobj,
  279. gprtobj,
  280. prtobj : string[80];
  281. s,s2 : string;
  282. found,linux_link_c,
  283. linklibc : boolean;
  284. procedure WriteRes(const s:string);
  285. begin
  286. if s<>'' then
  287. WriteLn(Linkresponse,s);
  288. end;
  289. procedure WriteResFileName(const s:string);
  290. begin
  291. if s<>'' then
  292. begin
  293. if not(s[1] in ['a'..'z','A'..'Z','/','\','.']) then
  294. Write(Linkresponse,'.',DirSep);
  295. WriteLn(Linkresponse,s);
  296. end;
  297. end;
  298. begin
  299. WriteResponseFile:=False;
  300. linux_link_c:=false;
  301. { set special options for some targets }
  302. linklibc:=SharedLibFiles.Find('c');
  303. prtobj:='prt0';
  304. cprtobj:='cprt0';
  305. gprtobj:='gprt0';
  306. if glibc21 then
  307. begin
  308. cprtobj:='cprt21';
  309. gprtobj:='gprt21';
  310. end;
  311. case target_info.target of
  312. target_m68k_Palmos,
  313. target_i386_Win32 :
  314. begin
  315. if DLLsource then
  316. prtobj:='wdllprt0'
  317. else
  318. prtobj:='wprt0';
  319. end;
  320. target_m68k_linux,
  321. target_i386_linux :
  322. begin
  323. if cs_profile in aktmoduleswitches then
  324. begin
  325. prtobj:=gprtobj;
  326. if not glibc2 then
  327. AddSharedLibrary('gmon');
  328. AddSharedLibrary('c');
  329. linklibc:=true;
  330. end
  331. else
  332. begin
  333. if linklibc then
  334. prtobj:=cprtobj;
  335. end;
  336. if linklibc then
  337. linux_link_c:=true;
  338. end;
  339. end;
  340. { Fix command line options }
  341. If not SharedLibFiles.Empty then
  342. LinkOptions:='-dynamic-linker='+DynamicLinker+' '+LinkOptions;
  343. if Strip and not(cs_debuginfo in aktmoduleswitches) and
  344. not (Target_Link.StripBind) then
  345. LinkOptions:=LinkOptions+' '+target_link.stripopt;
  346. { Open linkresponse and write header }
  347. assign(linkresponse,current_module^.outpath^+LinkResName);
  348. {$I-}
  349. rewrite(linkresponse);
  350. {$I+}
  351. if ioresult<>0 then
  352. exit;
  353. { Write library searchpath }
  354. if assigned(current_module^.locallibrarysearchpath) then
  355. begin
  356. S2:=current_module^.locallibrarysearchpath^;
  357. Repeat
  358. i:=Pos(';',S2);
  359. If i=0 then
  360. i:=255;
  361. S:=Copy(S2,1,i-1);
  362. If S<>'' then
  363. WriteRes(target_link.libpathprefix+s+target_link.libpathsuffix);
  364. Delete (S2,1,i);
  365. until S2='';
  366. end;
  367. S2:=LibrarySearchPath;
  368. Repeat
  369. i:=Pos(';',S2);
  370. If i=0 then
  371. i:=255;
  372. S:=Copy(S2,1,i-1);
  373. If S<>'' then
  374. WriteRes(target_link.libpathprefix+s+target_link.libpathsuffix);
  375. Delete (S2,1,i);
  376. until S2='';
  377. WriteRes(target_link.inputstart);
  378. { add objectfiles, start with prt0 always }
  379. if prtobj<>'' then
  380. WriteResFileName(FindObjectFile(prtobj));
  381. { try to add crti and crtbegin, they are normally not required, but
  382. adding can sometimes be usefull }
  383. if linux_link_c then
  384. begin
  385. s:=search('crtbegin.o',librarysearchpath,found)+'crtbegin.o';
  386. if found then
  387. WriteResFileName(s);
  388. s:=search('crti.o',librarysearchpath,found)+'crti.o';
  389. if found then
  390. WriteResFileName(s);
  391. end;
  392. while not ObjectFiles.Empty do
  393. begin
  394. s:=ObjectFiles.Get;
  395. if s<>'' then
  396. WriteResFileName(s);
  397. end;
  398. if linux_link_c then
  399. begin
  400. s:=search('crtend.o',librarysearchpath,found)+'crtend.o';
  401. if found then
  402. WriteResFileName(s);
  403. s:=search('crtn.o',librarysearchpath,found)+'crtn.o';
  404. if found then
  405. WriteResFileName(s);
  406. end;
  407. { Write sharedlibraries like -l<lib> }
  408. While not SharedLibFiles.Empty do
  409. begin
  410. S:=SharedLibFiles.Get;
  411. if s<>'c' then
  412. begin
  413. i:=Pos(target_os.sharedlibext,S);
  414. if i>0 then
  415. Delete(S,i,255);
  416. WriteRes(target_link.libprefix+s);
  417. end
  418. else
  419. linklibc:=true;
  420. end;
  421. { be sure that libc is the last lib }
  422. { arghhhh this is wrong for DJGPP !!!
  423. DJGPP need gcc after c lib (umod...) (PM) }
  424. if linklibc then
  425. WriteRes(target_link.libprefix+'c');
  426. { add libgcc after ! }
  427. if linklibc and (target_info.target=target_i386_go32v2) then
  428. WriteRes(target_link.libprefix+'gcc');
  429. WriteRes(target_link.inputend);
  430. { Write staticlibraries }
  431. if not StaticLibFiles.Empty then
  432. begin
  433. WriteRes(target_link.GroupStart);
  434. While not StaticLibFiles.Empty do
  435. begin
  436. S:=StaticLibFiles.Get;
  437. WriteResFileName(s)
  438. end;
  439. WriteRes(target_link.GroupEnd);
  440. end;
  441. { Close response }
  442. close(linkresponse);
  443. WriteResponseFile:=True;
  444. end;
  445. function TLinker.MakeExecutable:boolean;
  446. var
  447. bindbin : string[80];
  448. bindfound : boolean;
  449. s : string;
  450. success : boolean;
  451. ii : longint;
  452. begin
  453. {$ifdef linux}
  454. if LinkToC then
  455. begin
  456. AddObject('/usr/lib/crt0.o');
  457. AddObject('lprt');
  458. AddStaticLibrary('libc.a');
  459. AddStaticLibrary('libgcc.a');
  460. end;
  461. {$endif Linux}
  462. { Write used files and libraries }
  463. WriteResponseFile;
  464. { Call linker }
  465. if not(cs_link_extern in aktglobalswitches) then
  466. Message1(exec_i_linking,current_module^.exefilename^);
  467. s:=target_link.linkcmd;
  468. if DLLsource then
  469. Replace(s,'$EXE',current_module^.sharedlibfilename^)
  470. else
  471. Replace(s,'$EXE',current_module^.exefilename^);
  472. Replace(s,'$OPT',LinkOptions);
  473. Replace(s,'$RES',current_module^.outpath^+LinkResName);
  474. success:=DoExec(FindLinker,s,true,false);
  475. {Bind}
  476. if (target_link.bindbin[1]<>'') and
  477. ((target_info.target<>target_i386_win32) or bind_win32_dll) then
  478. for ii:=1 to target_link.binders do
  479. begin
  480. s:=target_link.bindcmd[ii];
  481. Replace(s,'$OPT',LinkOptions);
  482. Replace(s,'$RES',current_module^.outpath^+LinkResName);
  483. if DLLsource then
  484. Replace(s,'$EXE',current_module^.sharedlibfilename^)
  485. else
  486. Replace(s,'$EXE',current_module^.exefilename^);
  487. {Size of the heap when an EMX program runs in OS/2.}
  488. Replace(s,'$HEAPMB',tostr((maxheapsize+1048575) shr 20));
  489. {Size of the stack when an EMX program runs in OS/2.}
  490. Replace(s,'$STACKKB',tostr((stacksize+1023) shr 10));
  491. {When an EMX program runs in DOS, the heap and stack share the
  492. same memory pool. The heap grows upwards, the stack grows downwards.}
  493. Replace(s,'$DOSHEAPKB',tostr((stacksize+maxheapsize+1023) shr 10));
  494. if Strip and Target_Link.StripBind then
  495. Replace (S, '$STRIP', Target_Link.StripOpt) else
  496. Replace (S, '$STRIP', '');
  497. if utilsdirectory<>'' then
  498. begin
  499. bindbin:=Search(target_link.bindbin[ii]+source_os.exeext,
  500. utilsdirectory,bindfound)+target_link.bindbin[ii]+source_os.exeext;
  501. end
  502. else
  503. bindbin:=FindExe(target_link.bindbin[ii],bindfound);
  504. if (not bindfound) and not (cs_link_extern in aktglobalswitches) then
  505. begin
  506. Message1(exec_w_binder_not_found,bindbin);
  507. aktglobalswitches:=aktglobalswitches+[cs_link_extern];
  508. end;
  509. DoExec(bindbin,s,false,false);
  510. end;
  511. { Post processor executable }
  512. {$ifdef i386}
  513. if (target_info.target=target_i386_Win32) and success and
  514. not(cs_link_extern in aktglobalswitches) then
  515. if DLLsource then
  516. win_targ.postprocessexecutable(current_module^.sharedlibfilename^)
  517. else
  518. win_targ.postprocessexecutable(current_module^.exefilename^);
  519. {$endif}
  520. {Remove ReponseFile}
  521. if (success) and not(cs_link_extern in aktglobalswitches) then
  522. RemoveFile(current_module^.outpath^+LinkResName);
  523. MakeExecutable:=success; { otherwise a recursive call to link method }
  524. end;
  525. Procedure TLinker.MakeStaticLibrary(filescnt:longint);
  526. {
  527. FilesCnt holds the amount of .o files created, if filescnt=0 then
  528. no smartlinking is used
  529. }
  530. var
  531. smartpath,
  532. s,
  533. arbin : string;
  534. arfound : boolean;
  535. cnt : longint;
  536. begin
  537. smartpath:=current_module^.path^+FixPath(FixFileName(current_module^.modulename^)+target_info.smartext,false);
  538. { find ar binary }
  539. if utilsdirectory<>'' then
  540. begin
  541. arbin:=Search(target_ar.arbin+source_os.exeext,
  542. utilsdirectory,arfound)+target_ar.arbin+source_os.exeext;
  543. end
  544. else
  545. arbin:=FindExe(target_ar.arbin,arfound);
  546. if (not arfound) and not(cs_link_extern in aktglobalswitches) then
  547. begin
  548. Message(exec_w_ar_not_found);
  549. aktglobalswitches:=aktglobalswitches+[cs_link_extern];
  550. end;
  551. s:=target_ar.arcmd;
  552. Replace(s,'$LIB',current_module^.staticlibfilename^);
  553. if filescnt=0 then
  554. Replace(s,'$FILES',current_module^.objfilename^)
  555. else
  556. Replace(s,'$FILES',FixFileName(smartpath+current_module^.asmprefix^+'*'+target_info.objext));
  557. DoExec(arbin,s,false,true);
  558. { Clean up }
  559. if not(cs_asm_leave in aktglobalswitches) then
  560. if not(cs_link_extern in aktglobalswitches) then
  561. begin
  562. if filescnt=0 then
  563. RemoveFile(current_module^.objfilename^)
  564. else
  565. begin
  566. for cnt:=1 to filescnt do
  567. if not RemoveFile(FixFileName(smartpath+current_module^.asmprefix^+tostr(cnt)+target_info.objext)) then
  568. RemoveFile(FixFileName(smartpath+current_module^.asmprefix^+'e'+tostr(cnt)+target_info.objext));
  569. RemoveDir(smartpath);
  570. end;
  571. end
  572. else
  573. begin
  574. if filescnt=0 then
  575. AsmRes.AddDeleteCommand(current_module^.objfilename^)
  576. else
  577. begin
  578. AsmRes.AddDeleteCommand(smartpath+current_module^.asmprefix^+'*'+target_info.objext);
  579. AsmRes.Add('rmdir '+smartpath);
  580. end;
  581. end;
  582. end;
  583. Procedure TLinker.MakeSharedLibrary;
  584. var
  585. s : string;
  586. begin
  587. s:=' -shared -o $LIB $FILES';
  588. Replace(s,'$LIB',current_module^.sharedlibfilename^);
  589. Replace(s,'$FILES',current_module^.objfilename^);
  590. if DoExec(FindLinker,s,false,false) then
  591. RemoveFile(current_module^.objfilename^);
  592. end;
  593. end.
  594. {
  595. $Log$
  596. Revision 1.57 1999-06-28 16:02:31 peter
  597. * merged
  598. Revision 1.54.2.3 1999/06/28 15:55:40 peter
  599. * also search path if not found in utilsdirectory
  600. Revision 1.54.2.2 1999/06/18 09:51:55 peter
  601. * always use shell() for go32v2 to support LFN
  602. Revision 1.54.2.1 1999/06/15 13:51:56 peter
  603. * also check ld-2.1.so for glibc 2.1, previous was only for 2.1.1
  604. Revision 1.54 1999/06/02 13:25:35 hajny
  605. * fixed stripping symbols for OS/2
  606. Revision 1.53 1999/05/04 21:44:44 florian
  607. * changes to compile it with Delphi 4.0
  608. Revision 1.52 1999/05/03 21:30:30 peter
  609. + glibc 2.1
  610. Revision 1.51 1999/04/28 23:42:33 pierre
  611. * removing of temporary directory with -s option
  612. Revision 1.50 1999/04/25 14:31:48 daniel
  613. * Bug fixed in linking: compiling files on another drive than the one you
  614. currently use you is done correctly.
  615. Revision 1.49 1999/03/25 16:55:30 peter
  616. + unitpath,librarypath,includepath,objectpath directives
  617. Revision 1.48 1999/03/23 16:22:43 peter
  618. * crtbegin/crtend only added if found
  619. Revision 1.47 1999/02/05 16:45:47 michael
  620. + Fixed gluing of options
  621. Revision 1.46 1999/02/05 08:54:26 pierre
  622. + linkofiles splitted inot linkofiles and linkunitfiles
  623. because linkofiles must be stored with directory
  624. to enabled linking of different objects with same name
  625. in a different directory
  626. Revision 1.45 1999/01/29 10:33:07 peter
  627. * objectsearchpath is now also searched if an object is not found
  628. Revision 1.44 1999/01/27 13:07:58 pierre
  629. * problem related with libc : go32v2 and linux differences
  630. Revision 1.43 1999/01/25 15:02:13 peter
  631. * link libc always as last
  632. Revision 1.42 1998/12/11 00:03:19 peter
  633. + globtype,tokens,version unit splitted from globals
  634. Revision 1.41 1998/12/01 23:39:46 pierre
  635. * postprocessexec for win32 changed
  636. Revision 1.40 1998/12/01 12:51:20 peter
  637. * fixed placing of ppas.sh and link.res when using -FE
  638. Revision 1.39 1998/11/30 13:26:23 pierre
  639. * the code for ordering the exported procs/vars was buggy
  640. + added -WB to force binding (Ozerski way of creating DLL)
  641. this is off by default as direct writing of .edata section seems
  642. OK
  643. Revision 1.38 1998/11/30 09:43:13 pierre
  644. * some range check bugs fixed (still not working !)
  645. + added DLL writing support for win32 (also accepts variables)
  646. + TempAnsi for code that could be used for Temporary ansi strings
  647. handling
  648. Revision 1.37 1998/10/26 22:23:31 peter
  649. + fixpath() has an extra option to allow a ./ as path
  650. Revision 1.36 1998/10/22 15:18:44 florian
  651. + switch -vx for win32 added
  652. Revision 1.35 1998/10/19 18:06:23 peter
  653. * use no_double
  654. Revision 1.34 1998/10/16 13:37:18 florian
  655. + switch -FD added to specify the path for utilities
  656. Revision 1.33 1998/10/14 13:38:22 peter
  657. * fixed path with staticlib/objects in ppufiles
  658. Revision 1.32 1998/10/14 11:03:55 daniel
  659. * Forgot to dereference a pointer.
  660. Revision 1.31 1998/10/14 11:01:21 daniel
  661. * Staticlibfilename no longer not include a path. Correction when calling
  662. ar.
  663. Revision 1.30 1998/10/13 13:10:18 peter
  664. * new style for m68k/i386 infos and enums
  665. Revision 1.29 1998/10/13 08:19:34 pierre
  666. + source_os is now set correctly for cross-processor compilers
  667. (tos contains all target_infos and
  668. we use CPU86 and CPU68 conditionnals to
  669. get the source operating system
  670. this only works if you do not undefine
  671. the source target !!)
  672. * several cg68k memory leaks fixed
  673. + started to change the code so that it should be possible to have
  674. a complete compiler (both for m68k and i386 !!)
  675. Revision 1.28 1998/10/08 23:28:56 peter
  676. * -vu shows unit info, -vt shows tried/used files
  677. Revision 1.27 1998/10/06 17:16:52 pierre
  678. * some memory leaks fixed (thanks to Peter for heaptrc !)
  679. Revision 1.26 1998/09/29 15:23:05 peter
  680. * remove also the end files for smartlinking
  681. Revision 1.25 1998/09/10 15:25:31 daniel
  682. + Added maxheapsize.
  683. * Corrected semi-bug in calling the assembler and the linker
  684. Revision 1.24 1998/09/07 18:32:45 peter
  685. * fixed for m68k
  686. Revision 1.23 1998/09/03 17:39:04 florian
  687. + better code for type conversation longint/dword to real type
  688. Revision 1.22 1998/09/01 09:01:00 peter
  689. + glibc2 support
  690. Revision 1.21 1998/08/31 12:26:26 peter
  691. * m68k and palmos updates from surebugfixes
  692. Revision 1.20 1998/08/19 10:06:14 peter
  693. * fixed filenames and removedir which supports slash at the end
  694. Revision 1.19 1998/08/17 09:17:47 peter
  695. * static/shared linking updates
  696. Revision 1.18 1998/08/14 21:56:34 peter
  697. * setting the outputfile using -o works now to create static libs
  698. Revision 1.17 1998/08/14 18:16:08 peter
  699. * return after a failed call will now add it to ppas
  700. Revision 1.16 1998/08/12 19:28:15 peter
  701. * better libc support
  702. Revision 1.15 1998/08/10 14:50:02 peter
  703. + localswitches, moduleswitches, globalswitches splitting
  704. Revision 1.14 1998/06/17 14:10:13 peter
  705. * small os2 fixes
  706. * fixed interdependent units with newppu (remake3 under linux works now)
  707. Revision 1.13 1998/06/08 22:59:46 peter
  708. * smartlinking works for win32
  709. * some defines to exclude some compiler parts
  710. Revision 1.12 1998/06/04 23:51:44 peter
  711. * m68k compiles
  712. + .def file creation moved to gendef.pas so it could also be used
  713. for win32
  714. Revision 1.11 1998/05/27 00:20:31 peter
  715. * some scanner optimizes
  716. * automaticly aout2exe for go32v1
  717. * fixed dynamiclinker option which was added at the wrong place
  718. Revision 1.10 1998/05/22 12:32:47 peter
  719. * fixed -L on the commandline, Dos commandline is only 128 bytes
  720. Revision 1.9 1998/05/12 10:46:59 peter
  721. * moved printstatus to verb_def
  722. + V_Normal which is between V_Error and V_Warning and doesn't have a
  723. prefix like error: warning: and is included in V_Default
  724. * fixed some messages
  725. * first time parameter scan is only for -v and -T
  726. - removed old style messages
  727. Revision 1.8 1998/05/11 13:07:54 peter
  728. + $ifdef NEWPPU for the new ppuformat
  729. + $define GDB not longer required
  730. * removed all warnings and stripped some log comments
  731. * no findfirst/findnext anymore to remove smartlink *.o files
  732. Revision 1.7 1998/05/08 09:21:20 michael
  733. * Added missing -Fl message to messages file.
  734. * Corrected mangling of file names when doing Linklib
  735. * -Fl now actually WORKS.
  736. * Librarysearchpath is now a field in linker object.
  737. Revision 1.6 1998/05/06 09:26:49 peter
  738. * fixed ld call with shell
  739. Revision 1.4 1998/05/04 17:54:25 peter
  740. + smartlinking works (only case jumptable left todo)
  741. * redesign of systems.pas to support assemblers and linkers
  742. + Unitname is now also in the PPU-file, increased version to 14
  743. Revision 1.3 1998/04/16 10:54:30 daniel
  744. * Fixed linking for OS/2.
  745. }