* default to ppc64le/elfv2 when compiling on a ppc64le platform

* default to elfv2 abi when targeting ppc64le and no abi has been specified

git-svn-id: trunk@30193 -
This commit is contained in:
Jonas Maebe 2015-03-14 18:35:16 +00:00
parent 0e76a84e04
commit 3946971c73
3 changed files with 30 additions and 0 deletions

View File

@ -36,6 +36,7 @@ Type
NoPressEnter, NoPressEnter,
FPCHelpLines, FPCHelpLines,
LogoWritten, LogoWritten,
ABISetExplicitly,
FPUSetExplicitly, FPUSetExplicitly,
CPUSetExplicitly, CPUSetExplicitly,
OptCPUSetExplicitly: boolean; OptCPUSetExplicitly: boolean;
@ -1115,6 +1116,7 @@ begin
s:=upper(copy(more,j+1,length(more)-j)); s:=upper(copy(more,j+1,length(more)-j));
if not(SetAbiType(s,target_info.abi)) then if not(SetAbiType(s,target_info.abi)) then
IllegalPara(opt); IllegalPara(opt);
ABISetExplicitly:=true;
break; break;
end; end;
@ -3065,6 +3067,7 @@ begin
LogoWritten:=false; LogoWritten:=false;
NoPressEnter:=false; NoPressEnter:=false;
FirstPass:=false; FirstPass:=false;
ABISetExplicitly:=false;
FPUSetExplicitly:=false; FPUSetExplicitly:=false;
CPUSetExplicitly:=false; CPUSetExplicitly:=false;
OptCPUSetExplicitly:=false; OptCPUSetExplicitly:=false;
@ -3888,6 +3891,22 @@ if (target_info.abi = abi_eabihf) then
end; end;
{$endif} {$endif}
{$if defined(powerpc64)}
{ on sysv targets, default to elfv2 for little endian and to elfv1 for
big endian (unless specified otherwise). As the gcc man page says:
"Overriding the default ABI requires special system support and is
likely to fail in spectacular ways" }
if not option.ABISetExplicitly then
begin
if (target_info.abi=abi_powerpc_sysv) and
(target_info.endian=endian_little) then
target_info.abi:=abi_powerpc_elfv2
else
if (target_info.abi=abi_powerpc_elfv2) and
(target_info.endian=endian_big) then
target_info.abi:=abi_powerpc_sysv
end;
{$endif}
{ Section smartlinking conflicts with import sections on Windows } { Section smartlinking conflicts with import sections on Windows }
if GenerateImportSection and if GenerateImportSection and

View File

@ -982,6 +982,11 @@ initialization
{$ifdef CPUPOWERPC64} {$ifdef CPUPOWERPC64}
{$ifdef linux} {$ifdef linux}
set_source_info(system_powerpc64_linux_info); set_source_info(system_powerpc64_linux_info);
{ on a little endian PPC64 platform -> source is elfv2 }
{$ifdef FPC_LITTLE_ENDIAN}
source_info.endian:=endian_little;
source_info.abi:=abi_powerpc_elfv2;
{$endif}
{$endif linux} {$endif linux}
{$endif CPUPOWERPC64} {$endif CPUPOWERPC64}
{$ifdef CPUARM} {$ifdef CPUARM}

View File

@ -1518,6 +1518,12 @@ initialization
RegisterTarget(system_powerpc_linux_info); RegisterTarget(system_powerpc_linux_info);
{$endif powerpc} {$endif powerpc}
{$ifdef powerpc64} {$ifdef powerpc64}
{ default to little endian either when compiling with -dppc64le, or when
compiling on a little endian ppc64 platform }
{$if defined(ppc64le) or (defined(cpupowerpc64) and defined(FPC_LITTLE_ENDIAN))}
system_powerpc64_linux_info.endian:=endian_little;
system_powerpc64_linux_info.abi:=abi_powerpc_elfv2;
{$endif}
RegisterImport(system_powerpc64_linux,timportliblinux); RegisterImport(system_powerpc64_linux,timportliblinux);
RegisterExport(system_powerpc64_linux,texportliblinux); RegisterExport(system_powerpc64_linux,texportliblinux);
RegisterTarget(system_powerpc64_linux_info); RegisterTarget(system_powerpc64_linux_info);