mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
Function GetDefaultLibGCCDir adapted to case of Defaults not assigned (required for fpcmkcfg utility) reported by Andrew Kurushin
git-svn-id: trunk@48157 -
This commit is contained in:
parent
9003114a8f
commit
50a13b4df4
@ -2850,6 +2850,8 @@ function GetDefaultLibGCCDir(CPU : TCPU;OS: TOS; var ErrorMessage: string): stri
|
|||||||
var
|
var
|
||||||
CrossPrefix: string;
|
CrossPrefix: string;
|
||||||
UseBinutilsPrefix: boolean;
|
UseBinutilsPrefix: boolean;
|
||||||
|
SourceOS : TOS;
|
||||||
|
SourceCPU : TCPU;
|
||||||
|
|
||||||
function Get4thWord(const AString: string): string;
|
function Get4thWord(const AString: string): string;
|
||||||
var p: pchar;
|
var p: pchar;
|
||||||
@ -2916,24 +2918,35 @@ var
|
|||||||
begin
|
begin
|
||||||
result := '';
|
result := '';
|
||||||
ErrorMessage:='';
|
ErrorMessage:='';
|
||||||
if (Defaults.SourceOS<>OS) then
|
if assigned(Defaults) then
|
||||||
|
begin
|
||||||
|
SourceOS:=Defaults.SourceOS;
|
||||||
|
SourceCPU:=Defaults.SourceCPU;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SourceOS:=StringToOS({$I %FPCTARGETOS%});
|
||||||
|
SourceCPU:=StringToCPU({$I %FPCTARGETCPU%});
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (SourceOS<>OS) then
|
||||||
UseBinutilsPrefix:=true;
|
UseBinutilsPrefix:=true;
|
||||||
if (Defaults.SourceCPU<>CPU) then
|
if (SourceCPU<>CPU) then
|
||||||
begin
|
begin
|
||||||
{ we need to accept 32<->64 conversion }
|
{ we need to accept 32<->64 conversion }
|
||||||
{ expect for OpenBSD which does not allow this }
|
{ expect for OpenBSD which does not allow this }
|
||||||
if not(
|
if not(
|
||||||
((Defaults.SourceCPU=aarch64) and (CPU=arm)) or
|
((SourceCPU=aarch64) and (CPU=arm)) or
|
||||||
((Defaults.SourceCPU=powerpc64) and (CPU=powerpc)) or
|
((SourceCPU=powerpc64) and (CPU=powerpc)) or
|
||||||
((Defaults.SourceCPU=x86_64) and (CPU=i386)) or
|
((SourceCPU=x86_64) and (CPU=i386)) or
|
||||||
((Defaults.SourceCPU=riscv64) and (CPU=riscv32)) or
|
((SourceCPU=riscv64) and (CPU=riscv32)) or
|
||||||
((Defaults.SourceCPU=sparc64) and (CPU=sparc)) or
|
((SourceCPU=sparc64) and (CPU=sparc)) or
|
||||||
((CPU=aarch64) and (Defaults.SourceCPU=arm)) or
|
((CPU=aarch64) and (SourceCPU=arm)) or
|
||||||
((CPU=powerpc64) and (Defaults.SourceCPU=powerpc)) or
|
((CPU=powerpc64) and (SourceCPU=powerpc)) or
|
||||||
((CPU=x86_64) and (Defaults.SourceCPU=i386)) or
|
((CPU=x86_64) and (SourceCPU=i386)) or
|
||||||
((CPU=riscv64) and (Defaults.SourceCPU=riscv32)) or
|
((CPU=riscv64) and (SourceCPU=riscv32)) or
|
||||||
((CPU=sparc64) and (Defaults.SourceCPU=sparc))
|
((CPU=sparc64) and (SourceCPU=sparc))
|
||||||
) or (Defaults.SourceOS=openbsd) then
|
) or (SourceOS=openbsd) then
|
||||||
UseBinutilsPrefix:=true;
|
UseBinutilsPrefix:=true;
|
||||||
end;
|
end;
|
||||||
if not UseBinutilsPrefix then
|
if not UseBinutilsPrefix then
|
||||||
|
Loading…
Reference in New Issue
Block a user