mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 12:41:37 +02:00
* fixed handling of directories with spaces for LdSupportsNoResponseFile-
targets (a.o. darwin) in case no ppas.sh is generated (need to generate a temporary script in that case as well to use the IFS trick) * fixed exit code checking of ld when using IFS trick (have to check it before restoring IFS, otherwise we check the "error result" of this restoration, which will always be 0) git-svn-id: trunk@9325 -
This commit is contained in:
parent
2d99011152
commit
0ac6e82c1f
@ -382,8 +382,8 @@ begin
|
||||
Add('IFS="');
|
||||
Add('"');
|
||||
Add(maybequoted(command)+' '+Options);
|
||||
Add('IFS=$OFS');
|
||||
Add('if [ $? != 0 ]; then DoExitLink '+ScriptFixFileName(FileName)+'; fi');
|
||||
Add('IFS=$OFS');
|
||||
end;
|
||||
|
||||
|
||||
|
@ -557,11 +557,12 @@ function TLinkerBSD.MakeExecutable:boolean;
|
||||
var
|
||||
binstr,
|
||||
cmdstr : TCmdStr;
|
||||
success : boolean;
|
||||
linkscript: TAsmScript;
|
||||
DynLinkStr : string[60];
|
||||
GCSectionsStr,
|
||||
StaticStr,
|
||||
StripStr : string[40];
|
||||
success : boolean;
|
||||
begin
|
||||
if not(cs_link_nolink in current_settings.globalswitches) then
|
||||
Message1(exec_i_linking,current_module.exefilename^);
|
||||
@ -618,11 +619,30 @@ begin
|
||||
Replace(cmdstr,'$STRIP',StripStr);
|
||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
||||
Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
||||
success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,LdSupportsNoResponseFile);
|
||||
BinStr:=FindUtil(utilsprefix+BinStr);
|
||||
|
||||
if (LdSupportsNoResponseFile) and
|
||||
not(cs_link_nolink in current_settings.globalswitches) then
|
||||
begin
|
||||
{ we have to use a script to use the IFS hack }
|
||||
linkscript:=TAsmScriptUnix.create(outputexedir+'ppaslink');
|
||||
linkscript.AddLinkCommand(BinStr,CmdStr,'');
|
||||
linkscript.WriteToDisk;
|
||||
BinStr:=linkscript.fn;
|
||||
if not path_absolute(BinStr) then
|
||||
BinStr:='./'+BinStr;
|
||||
CmdStr:='';
|
||||
end;
|
||||
|
||||
success:=DoExec(BinStr,CmdStr,true,LdSupportsNoResponseFile);
|
||||
|
||||
{ Remove ReponseFile }
|
||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||
DeleteFile(outputexedir+Info.ResName);
|
||||
begin
|
||||
DeleteFile(outputexedir+Info.ResName);
|
||||
DeleteFile(linkscript.fn);
|
||||
linkscript.free
|
||||
end;
|
||||
|
||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||
end;
|
||||
@ -633,6 +653,7 @@ var
|
||||
InitStr,
|
||||
FiniStr,
|
||||
SoNameStr : string[80];
|
||||
linkscript: TAsmScript;
|
||||
binstr,
|
||||
cmdstr : TCmdStr;
|
||||
success : boolean;
|
||||
@ -660,8 +681,22 @@ begin
|
||||
Replace(cmdstr,'$INIT',InitStr);
|
||||
Replace(cmdstr,'$FINI',FiniStr);
|
||||
Replace(cmdstr,'$SONAME',SoNameStr);
|
||||
BinStr:=FindUtil(utilsprefix+BinStr);
|
||||
|
||||
success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,LdSupportsNoResponseFile);
|
||||
if (LdSupportsNoResponseFile) and
|
||||
not(cs_link_nolink in current_settings.globalswitches) then
|
||||
begin
|
||||
{ we have to use a script to use the IFS hack }
|
||||
linkscript:=TAsmScriptUnix.create(outputexedir+'ppaslink');
|
||||
linkscript.AddLinkCommand(BinStr,CmdStr,'');
|
||||
linkscript.WriteToDisk;
|
||||
BinStr:=linkscript.fn;
|
||||
if not path_absolute(BinStr) then
|
||||
BinStr:='./'+BinStr;
|
||||
CmdStr:='';
|
||||
end;
|
||||
|
||||
success:=DoExec(BinStr,cmdstr,true,LdSupportsNoResponseFile);
|
||||
|
||||
{ Strip the library ? }
|
||||
if success and (cs_link_strip in current_settings.globalswitches) then
|
||||
@ -673,7 +708,11 @@ begin
|
||||
|
||||
{ Remove ReponseFile }
|
||||
if (success) and not(cs_link_nolink in current_settings.globalswitches) then
|
||||
DeleteFile(outputexedir+Info.ResName);
|
||||
begin
|
||||
DeleteFile(outputexedir+Info.ResName);
|
||||
// DeleteFile(linkscript.fn);
|
||||
linkscript.free
|
||||
end;
|
||||
|
||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user