mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 17:59:25 +02:00
* fixed placing of .sl directories
* use -b again for base-file selection * fixed group writing for linux with smartlinking
This commit is contained in:
parent
9e78512a5e
commit
6607475609
@ -77,11 +77,12 @@ type
|
||||
procedure WriteAsmList;virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
SmartLinkFilesCnt : longint;
|
||||
|
||||
Procedure GenerateAsm(smart:boolean);
|
||||
Procedure OnlyAsm;
|
||||
|
||||
var
|
||||
SmartLinkFilesCnt : longint;
|
||||
|
||||
Implementation
|
||||
|
||||
@ -267,6 +268,8 @@ begin
|
||||
end;
|
||||
AsmFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.asmext);
|
||||
ObjFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.objext);
|
||||
{ insert in container so it can be cleared after the linking }
|
||||
SmartLinkOFiles.Insert(Objfile);
|
||||
end;
|
||||
|
||||
|
||||
@ -435,13 +438,14 @@ begin
|
||||
name:=FixFileName(current_module^.modulename^);
|
||||
OutCnt:=0;
|
||||
SmartLinkFilesCnt:=0;
|
||||
SmartLinkOFiles.Clear;
|
||||
place:=cut_normal;
|
||||
SmartAsm:=smart;
|
||||
SmartHCount:=0;
|
||||
{ Which path will be used ? }
|
||||
if SmartAsm then
|
||||
begin
|
||||
path:=current_module^.path^+FixFileName(current_module^.modulename^)+target_info.smartext;
|
||||
path:=current_module^.outputpath^+FixFileName(current_module^.modulename^)+target_info.smartext;
|
||||
{$I-}
|
||||
mkdir(path);
|
||||
{$I+}
|
||||
@ -449,7 +453,7 @@ begin
|
||||
path:=FixPath(path,false);
|
||||
end
|
||||
else
|
||||
path:=current_module^.path^;
|
||||
path:=current_module^.outputpath^;
|
||||
end;
|
||||
|
||||
|
||||
@ -560,11 +564,15 @@ begin
|
||||
dispose(a,Done);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.59 2000-01-07 01:14:19 peter
|
||||
Revision 1.60 2000-01-11 09:52:06 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.59 2000/01/07 01:14:19 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.58 1999/11/12 11:03:49 peter
|
||||
|
@ -206,6 +206,7 @@ unit files;
|
||||
locallibrarysearchpath : TSearchPathList;
|
||||
|
||||
path, { path where the module is find/created }
|
||||
outputpath, { path where the .s / .o / exe are created }
|
||||
modulename, { name of the module in uppercase }
|
||||
objfilename, { fullname of the objectfile }
|
||||
asmfilename, { fullname of the assemblerfile }
|
||||
@ -252,13 +253,15 @@ unit files;
|
||||
end;
|
||||
|
||||
var
|
||||
main_module : pmodule; { Main module of the program }
|
||||
current_module : pmodule; { Current module which is compiled or loaded }
|
||||
compiled_module : pmodule; { Current module which is compiled }
|
||||
current_ppu : pppufile; { Current ppufile which is read }
|
||||
main_module : pmodule; { Main module of the program }
|
||||
current_module : pmodule; { Current module which is compiled or loaded }
|
||||
compiled_module : pmodule; { Current module which is compiled }
|
||||
current_ppu : pppufile; { Current ppufile which is read }
|
||||
global_unit_count : word;
|
||||
usedunits : tlinkedlist; { Used units for this program }
|
||||
loaded_units : tlinkedlist; { All loaded units }
|
||||
usedunits : tlinkedlist; { Used units for this program }
|
||||
loaded_units : tlinkedlist; { All loaded units }
|
||||
SmartLinkOFiles : TStringContainer; { List of .o files which are generated,
|
||||
used to delete them after linking }
|
||||
|
||||
function get_source_file(moduleindex,fileindex : word) : pinputfile;
|
||||
|
||||
@ -811,6 +814,7 @@ end;
|
||||
stringdispose(staticlibfilename);
|
||||
stringdispose(sharedlibfilename);
|
||||
stringdispose(exefilename);
|
||||
stringdispose(outputpath);
|
||||
stringdispose(path);
|
||||
{ Create names }
|
||||
fsplit(fn,p,n,e);
|
||||
@ -827,6 +831,7 @@ end;
|
||||
if (OutputExeDir<>'') then
|
||||
p:=OutputExeDir;
|
||||
end;
|
||||
outputpath:=stringdup(p);
|
||||
objfilename:=stringdup(p+n+target_info.objext);
|
||||
asmfilename:=stringdup(p+n+target_info.asmext);
|
||||
ppufilename:=stringdup(p+n+target_info.unitext);
|
||||
@ -1186,6 +1191,7 @@ end;
|
||||
{$else}
|
||||
asmprefix:=stringdup(FixFileName(n));
|
||||
{$endif}
|
||||
outputpath:=nil;
|
||||
path:=nil;
|
||||
setfilename(p+n,true);
|
||||
localunitsearchpath.init;
|
||||
@ -1273,6 +1279,7 @@ end;
|
||||
stringdispose(staticlibfilename);
|
||||
stringdispose(sharedlibfilename);
|
||||
stringdispose(exefilename);
|
||||
stringdispose(outputpath);
|
||||
stringdispose(path);
|
||||
stringdispose(modulename);
|
||||
stringdispose(mainsource);
|
||||
@ -1348,7 +1355,12 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.112 2000-01-07 01:14:27 peter
|
||||
Revision 1.113 2000-01-11 09:52:06 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.112 2000/01/07 01:14:27 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.111 1999/12/08 01:01:11 peter
|
||||
|
@ -63,7 +63,7 @@ Type
|
||||
procedure SetDefaultInfo;virtual;
|
||||
Function MakeExecutable:boolean;virtual;
|
||||
Function MakeSharedLibrary:boolean;virtual;
|
||||
Function MakeStaticLibrary(filescnt:longint):boolean;virtual;
|
||||
Function MakeStaticLibrary:boolean;virtual;
|
||||
end;
|
||||
|
||||
Var
|
||||
@ -173,7 +173,16 @@ begin
|
||||
if (cs_link_static in aktglobalswitches) then
|
||||
begin
|
||||
if (flags and uf_static_linked)=0 then
|
||||
Comment(V_Error,'unit '+modulename^+' can''t be static linked')
|
||||
begin
|
||||
{ if smart not avail then try static linking }
|
||||
if (flags and uf_static_linked)<>0 then
|
||||
begin
|
||||
Comment(V_Hint,'unit '+modulename^+' can''t be static linked, switching to smart linking');
|
||||
mask:=mask or link_smart;
|
||||
end
|
||||
else
|
||||
Comment(V_Error,'unit '+modulename^+' can''t be smart or static linked');
|
||||
end
|
||||
else
|
||||
mask:=mask or link_static;
|
||||
end;
|
||||
@ -185,7 +194,7 @@ begin
|
||||
{ if smart not avail then try static linking }
|
||||
if (flags and uf_static_linked)<>0 then
|
||||
begin
|
||||
Comment(V_Warning,'unit '+modulename^+' can''t be smart linked, switching to static linking');
|
||||
Comment(V_Hint,'unit '+modulename^+' can''t be smart linked, switching to static linking');
|
||||
mask:=mask or link_static;
|
||||
end
|
||||
else
|
||||
@ -202,7 +211,7 @@ begin
|
||||
{ if shared not avail then try static linking }
|
||||
if (flags and uf_static_linked)<>0 then
|
||||
begin
|
||||
Comment(V_Warning,'unit '+modulename^+' can''t be shared linked, switching to static linking');
|
||||
Comment(V_Hint,'unit '+modulename^+' can''t be shared linked, switching to static linking');
|
||||
mask:=mask or link_static;
|
||||
end
|
||||
else
|
||||
@ -412,11 +421,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
Function TLinker.MakeStaticLibrary(filescnt:longint):boolean;
|
||||
{
|
||||
FilesCnt holds the amount of .o files created, if filescnt=0 then
|
||||
no smartlinking is used
|
||||
}
|
||||
Function TLinker.MakeStaticLibrary:boolean;
|
||||
var
|
||||
smartpath,
|
||||
cmdstr,
|
||||
@ -426,38 +431,24 @@ var
|
||||
begin
|
||||
MakeStaticLibrary:=false;
|
||||
|
||||
smartpath:=current_module^.path^+FixPath(FixFileName(current_module^.modulename^)+target_info.smartext,false);
|
||||
smartpath:=current_module^.outputpath^+FixPath(FixFileName(current_module^.modulename^)+target_info.smartext,false);
|
||||
SplitBinCmd(target_ar.arcmd,binstr,cmdstr);
|
||||
Replace(cmdstr,'$LIB',current_module^.staticlibfilename^);
|
||||
if filescnt=0 then
|
||||
Replace(cmdstr,'$FILES',current_module^.objfilename^)
|
||||
else
|
||||
Replace(cmdstr,'$FILES',FixFileName(smartpath+current_module^.asmprefix^+'*'+target_info.objext));
|
||||
Replace(cmdstr,'$FILES',FixFileName(smartpath+current_module^.asmprefix^+'*'+target_info.objext));
|
||||
success:=DoExec(FindUtil(binstr),cmdstr,false,true);
|
||||
|
||||
{ Clean up }
|
||||
if not(cs_asm_leave in aktglobalswitches) then
|
||||
if not(cs_link_extern in aktglobalswitches) then
|
||||
begin
|
||||
if filescnt=0 then
|
||||
RemoveFile(current_module^.objfilename^)
|
||||
else
|
||||
begin
|
||||
for cnt:=1 to filescnt do
|
||||
if not RemoveFile(FixFileName(smartpath+current_module^.asmprefix^+tostr(cnt)+target_info.objext)) then
|
||||
RemoveFile(FixFileName(smartpath+current_module^.asmprefix^+'e'+tostr(cnt)+target_info.objext));
|
||||
RemoveDir(smartpath);
|
||||
end;
|
||||
while not SmartLinkOFiles.Empty do
|
||||
RemoveFile(SmartLinkOFiles.Get);
|
||||
RemoveDir(smartpath);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if filescnt=0 then
|
||||
AsmRes.AddDeleteCommand(current_module^.objfilename^)
|
||||
else
|
||||
begin
|
||||
AsmRes.AddDeleteCommand(smartpath+current_module^.asmprefix^+'*'+target_info.objext);
|
||||
AsmRes.Add('rmdir '+smartpath);
|
||||
end;
|
||||
AsmRes.AddDeleteCommand(FixFileName(smartpath+current_module^.asmprefix^+'*'+target_info.objext));
|
||||
AsmRes.Add('rmdir '+smartpath);
|
||||
end;
|
||||
MakeStaticLibrary:=success;
|
||||
end;
|
||||
@ -530,7 +521,12 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.79 2000-01-07 01:14:27 peter
|
||||
Revision 1.80 2000-01-11 09:52:06 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.79 2000/01/07 01:14:27 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.78 1999/11/22 22:22:30 pierre
|
||||
|
@ -116,6 +116,9 @@ unit parser;
|
||||
|
||||
{ open deffile }
|
||||
DefFile.Init(outputexedir+inputfile+target_os.defext);
|
||||
|
||||
{ list of generated .o files, so the linker can remove them }
|
||||
SmartLinkOFiles.init;
|
||||
end;
|
||||
|
||||
|
||||
@ -125,9 +128,12 @@ unit parser;
|
||||
loaded_units.done;
|
||||
usedunits.done;
|
||||
|
||||
{ close ppas and deffile }
|
||||
{ close ppas,deffile }
|
||||
asmres.done;
|
||||
deffile.done;
|
||||
|
||||
{ free list of .o files }
|
||||
SmartLinkOFiles.done;
|
||||
end;
|
||||
|
||||
|
||||
@ -581,7 +587,12 @@ unit parser;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.96 2000-01-07 01:14:28 peter
|
||||
Revision 1.97 2000-01-11 09:52:06 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.96 2000/01/07 01:14:28 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.95 2000/01/04 15:15:52 florian
|
||||
|
@ -76,7 +76,7 @@ unit pmodules;
|
||||
|
||||
GenerateAsm(true);
|
||||
if target_asm.needar then
|
||||
Linker^.MakeStaticLibrary(SmartLinkFilesCnt);
|
||||
Linker^.MakeStaticLibrary;
|
||||
end;
|
||||
|
||||
{ resource files }
|
||||
@ -1561,7 +1561,12 @@ unit pmodules;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.178 2000-01-07 01:14:29 peter
|
||||
Revision 1.179 2000-01-11 09:52:07 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.178 2000/01/07 01:14:29 peter
|
||||
* updated copyright to 2000
|
||||
|
||||
Revision 1.177 1999/12/20 22:29:26 pierre
|
||||
|
@ -310,6 +310,7 @@ begin
|
||||
s:=librarysearchpath.FindFile('crtn.o',found)+'crtn.o';
|
||||
if found then
|
||||
LinkRes.AddFileName(s);
|
||||
LinkRes.Add(')');
|
||||
|
||||
{ Write staticlibraries }
|
||||
if not StaticLibFiles.Empty then
|
||||
@ -325,29 +326,32 @@ begin
|
||||
|
||||
{ Write sharedlibraries like -l<lib>, also add the needed dynamic linker
|
||||
here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
|
||||
While not SharedLibFiles.Empty do
|
||||
if not SharedLibFiles.Empty then
|
||||
begin
|
||||
S:=SharedLibFiles.Get;
|
||||
if s<>'c' then
|
||||
LinkRes.Add('INPUT(');
|
||||
While not SharedLibFiles.Empty do
|
||||
begin
|
||||
i:=Pos(target_os.sharedlibext,S);
|
||||
if i>0 then
|
||||
Delete(S,i,255);
|
||||
LinkRes.Add('-l'+s);
|
||||
end
|
||||
else
|
||||
begin
|
||||
linklibc:=true;
|
||||
linkdynamic:=false; { libc will include the ld-linux for us }
|
||||
S:=SharedLibFiles.Get;
|
||||
if s<>'c' then
|
||||
begin
|
||||
i:=Pos(target_os.sharedlibext,S);
|
||||
if i>0 then
|
||||
Delete(S,i,255);
|
||||
LinkRes.Add('-l'+s);
|
||||
end
|
||||
else
|
||||
begin
|
||||
linklibc:=true;
|
||||
linkdynamic:=false; { libc will include the ld-linux for us }
|
||||
end;
|
||||
end;
|
||||
{ be sure that libc is the last lib }
|
||||
if linklibc then
|
||||
LinkRes.Add('-lc');
|
||||
if linkdynamic and (Info.DynamicLinker<>'') then
|
||||
LinkRes.AddFileName(Info.DynamicLinker);
|
||||
LinkRes.Add(')');
|
||||
end;
|
||||
{ be sure that libc is the last lib }
|
||||
if linklibc then
|
||||
LinkRes.Add('-lc');
|
||||
if linkdynamic and (Info.DynamicLinker<>'') then
|
||||
LinkRes.AddFileName(Info.DynamicLinker);
|
||||
LinkRes.Add(')');
|
||||
|
||||
{ Write and Close response }
|
||||
linkres.writetodisk;
|
||||
linkres.done;
|
||||
@ -435,7 +439,12 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 2000-01-09 00:55:51 pierre
|
||||
Revision 1.8 2000-01-11 09:52:07 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.7 2000/01/09 00:55:51 pierre
|
||||
* GROUP of smartlink units put before the C libraries
|
||||
to allow for smartlinking code that uses C code.
|
||||
|
||||
|
@ -749,10 +749,8 @@ begin
|
||||
StripStr:='';
|
||||
AsBinStr:=FindExe('asw',found);
|
||||
if RelocSection then
|
||||
RelocStr:='--base-file base.$$$';
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos.
|
||||
But not all dlltool.exe support this short form
|
||||
RelocStr:='-b base.$$$'; }
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos. }
|
||||
RelocStr:='-b base.$$$';
|
||||
if apptype=at_gui then
|
||||
AppTypeStr:='--subsystem windows';
|
||||
if assigned(DLLImageBase) then
|
||||
@ -831,10 +829,8 @@ begin
|
||||
StripStr:='';
|
||||
AsBinStr:=FindExe('asw',found);
|
||||
if RelocSection then
|
||||
RelocStr:='--base-file base.$$$';
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos.
|
||||
But not all dlltool.exe support this short form
|
||||
RelocStr:='-b base.$$$'; }
|
||||
{ Using short form to avoid problems with 128 char limitation under Dos. }
|
||||
RelocStr:='-b base.$$$';
|
||||
if apptype=at_gui then
|
||||
AppTypeStr:='--subsystem windows';
|
||||
if assigned(DLLImageBase) then
|
||||
@ -1083,7 +1079,12 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.16 2000-01-09 00:55:51 pierre
|
||||
Revision 1.17 2000-01-11 09:52:07 peter
|
||||
* fixed placing of .sl directories
|
||||
* use -b again for base-file selection
|
||||
* fixed group writing for linux with smartlinking
|
||||
|
||||
Revision 1.16 2000/01/09 00:55:51 pierre
|
||||
* GROUP of smartlink units put before the C libraries
|
||||
to allow for smartlinking code that uses C code.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user