* 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,
FPCHelpLines,
LogoWritten,
ABISetExplicitly,
FPUSetExplicitly,
CPUSetExplicitly,
OptCPUSetExplicitly: boolean;
@ -1115,6 +1116,7 @@ begin
s:=upper(copy(more,j+1,length(more)-j));
if not(SetAbiType(s,target_info.abi)) then
IllegalPara(opt);
ABISetExplicitly:=true;
break;
end;
@ -3065,6 +3067,7 @@ begin
LogoWritten:=false;
NoPressEnter:=false;
FirstPass:=false;
ABISetExplicitly:=false;
FPUSetExplicitly:=false;
CPUSetExplicitly:=false;
OptCPUSetExplicitly:=false;
@ -3888,6 +3891,22 @@ if (target_info.abi = abi_eabihf) then
end;
{$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 }
if GenerateImportSection and

View File

@ -982,6 +982,11 @@ initialization
{$ifdef CPUPOWERPC64}
{$ifdef linux}
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 CPUPOWERPC64}
{$ifdef CPUARM}

View File

@ -1518,6 +1518,12 @@ initialization
RegisterTarget(system_powerpc_linux_info);
{$endif powerpc}
{$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);
RegisterExport(system_powerpc64_linux,texportliblinux);
RegisterTarget(system_powerpc64_linux_info);