mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 05:48:59 +02:00
* Enabling crosscompiling from Windows towards Darwin. Patch from Alfred (mantis 31099). Thanks! :)
git-svn-id: trunk@36168 -
This commit is contained in:
parent
e6aa46f7f9
commit
fa75f25fac
@ -147,8 +147,8 @@ begin
|
||||
begin
|
||||
if not(target_info.system in systems_darwin) then
|
||||
begin
|
||||
ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $CATRES';
|
||||
DllCmd[1]:='ld $TARGET $EMUL $OPT -shared -L. -o $EXE $CATRES'
|
||||
ExeCmd[1]:='ld $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $CATRES $FILELIST';
|
||||
DllCmd[1]:='ld $TARGET $EMUL $OPT -shared -L. -o $EXE $CATRES $FILELIST'
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -167,16 +167,16 @@ begin
|
||||
programs with problems that require Valgrind will have more
|
||||
than 60KB of data (first 4KB of address space is always invalid)
|
||||
}
|
||||
ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES';
|
||||
ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
||||
if not(cs_gdb_valgrind in current_settings.globalswitches) then
|
||||
ExeCmd[1]:=ExeCmd[1]+' -pagezero_size 0x10000';
|
||||
{$else ndef cpu64bitaddr}
|
||||
ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES';
|
||||
ExeCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST';
|
||||
{$endif ndef cpu64bitaddr}
|
||||
if (apptype<>app_bundle) then
|
||||
DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -dylib -multiply_defined suppress -L. -o $EXE $CATRES'
|
||||
DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -dylib -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
||||
else
|
||||
DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -bundle -multiply_defined suppress -L. -o $EXE $CATRES'
|
||||
DllCmd[1]:='ld $PRTOBJ $TARGET $EMUL $OPT $GCSECTIONS -dynamic -bundle -multiply_defined suppress -L. -o $EXE $CATRES $FILELIST'
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -388,6 +388,7 @@ end;
|
||||
Function TLinkerBSD.WriteResponseFile(isdll:boolean) : Boolean;
|
||||
Var
|
||||
linkres : TLinkRes;
|
||||
FilesList : TLinkRes;
|
||||
i : longint;
|
||||
cprtobj,
|
||||
gprtobj,
|
||||
@ -588,16 +589,44 @@ begin
|
||||
else if librarysearchpath.FindFile('crtbegin.o',false,s) then
|
||||
LinkRes.AddFileName(s);
|
||||
end;
|
||||
|
||||
{ main objectfiles }
|
||||
while not ObjectFiles.Empty do
|
||||
|
||||
{ Generate linkfiles.res file if needed }
|
||||
{ Only needed on Windows, due to the limitation of 8196 characters for command line }
|
||||
if (LdSupportsNoResponseFile) and
|
||||
(source_info.system in systems_all_windows) then
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
if s<>'' then
|
||||
if LdSupportsNoResponseFile then
|
||||
LinkRes.AddFileName(s)
|
||||
else
|
||||
LinkRes.AddFileName(maybequoted(s));
|
||||
FilesList:=TLinkRes.Create(outputexedir+'linkfiles.res',false);
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
if s<>'' then
|
||||
begin
|
||||
repeat
|
||||
i:=Pos(source_info.dirsep,s);
|
||||
if i>0 then
|
||||
s[i]:=target_info.dirsep;
|
||||
until i=0;
|
||||
FilesList.Add(s);
|
||||
end;
|
||||
end;
|
||||
FilesList.writetodisk;
|
||||
FilesList.Free;
|
||||
end
|
||||
else
|
||||
begin
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
if s<>'' then
|
||||
if LdSupportsNoResponseFile then
|
||||
LinkRes.AddFileName(s)
|
||||
else
|
||||
LinkRes.AddFileName(maybequoted(s));
|
||||
end;
|
||||
end;
|
||||
|
||||
if not LdSupportsNoResponseFile then
|
||||
LinkRes.Add(')');
|
||||
|
||||
@ -784,6 +813,10 @@ begin
|
||||
Replace(cmdstr,'$EMUL',EmulStr);
|
||||
Replace(cmdstr,'$CATRES',CatFileContent(outputexedir+Info.ResName));
|
||||
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
|
||||
if (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
||||
Replace(cmdstr,'$FILELIST','-filelist '+maybequoted(outputexedir+'linkfiles.res'))
|
||||
else
|
||||
Replace(cmdstr,'$FILELIST','');
|
||||
Replace(cmdstr,'$STATIC',StaticStr);
|
||||
Replace(cmdstr,'$STRIP',StripStr);
|
||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
||||
@ -807,14 +840,17 @@ begin
|
||||
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:=GenerateScript(outputexedir+'ppaslink');
|
||||
linkscript.AddLinkCommand(BinStr,CmdStr,'');
|
||||
if (extdbgcmdstr<>'') then
|
||||
linkscript.AddLinkCommand(extdbgbinstr,extdbgcmdstr,'');
|
||||
linkscript.WriteToDisk;
|
||||
BinStr:=linkscript.fn;
|
||||
if not path_absolute(BinStr) then
|
||||
BinStr:='./'+BinStr;
|
||||
if cs_link_on_target in current_settings.globalswitches then
|
||||
BinStr:='.'+target_info.dirsep+BinStr
|
||||
else
|
||||
BinStr:='.'+source_info.dirsep+BinStr;
|
||||
CmdStr:='';
|
||||
end;
|
||||
|
||||
@ -836,6 +872,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Remove linkfiles.res }
|
||||
if (success) and (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
||||
DeleteFile(outputexedir+'linkfiles.res');
|
||||
|
||||
MakeExecutable:=success; { otherwise a recursive call to link method }
|
||||
end;
|
||||
|
||||
@ -902,6 +942,10 @@ begin
|
||||
Replace(cmdstr,'$TARGET',targetstr);
|
||||
Replace(cmdstr,'$EMUL',EmulStr);
|
||||
Replace(cmdstr,'$CATRES',CatFileContent(outputexedir+Info.ResName));
|
||||
if (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
||||
Replace(cmdstr,'$FILELIST','-filelist '+maybequoted(outputexedir+'linkfiles.res'))
|
||||
else
|
||||
Replace(cmdstr,'$FILELIST','');
|
||||
Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
|
||||
Replace(cmdstr,'$INIT',InitStr);
|
||||
Replace(cmdstr,'$FINI',FiniStr);
|
||||
@ -941,14 +985,17 @@ begin
|
||||
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:=GenerateScript(outputexedir+'ppaslink');
|
||||
linkscript.AddLinkCommand(BinStr,CmdStr,'');
|
||||
if (extdbgbinstr<>'') then
|
||||
linkscript.AddLinkCommand(extdbgbinstr,extdbgcmdstr,'');
|
||||
linkscript.WriteToDisk;
|
||||
BinStr:=linkscript.fn;
|
||||
if not path_absolute(BinStr) then
|
||||
BinStr:='./'+BinStr;
|
||||
if cs_link_on_target in current_settings.globalswitches then
|
||||
BinStr:='.'+target_info.dirsep+BinStr
|
||||
else
|
||||
BinStr:='.'+source_info.dirsep+BinStr;
|
||||
CmdStr:='';
|
||||
end;
|
||||
|
||||
@ -979,6 +1026,10 @@ begin
|
||||
DeleteFile(outputexedir+'linksyms.fpc');
|
||||
end;
|
||||
|
||||
{ Remove linkfiles.res }
|
||||
if (success) and (LdSupportsNoResponseFile) and (source_info.system in systems_all_windows) then
|
||||
DeleteFile(outputexedir+'linkfiles.res');
|
||||
|
||||
MakeSharedLibrary:=success; { otherwise a recursive call to link method }
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user