diff --git a/compiler/mips/cpugas.pas b/compiler/mips/cpugas.pas index 2c6fb3585f..ff3e085ea2 100644 --- a/compiler/mips/cpugas.pas +++ b/compiler/mips/cpugas.pas @@ -57,6 +57,26 @@ unit cpugas; globals, verbose, itcpugas, cgbase, cgutils; + { abi strings as accepted by + GNU assembler in -abi=XXX option } + function gas_abitype(abi : tabi) : string; + begin + case abi of + abi_eabi: + result:='eabi'; + abi_mips_o32: + result:='32'; + abi_mips_n32: + result:='n32'; + abi_mips_o64: + result:='o64'; + abi_mips_n64: + result:='64'; + else + result:='32'; + end; + end; + function asm_regname(reg : TRegister) : string; begin @@ -83,7 +103,7 @@ unit cpugas; begin result := Inherited MakeCmdLine; { ABI selection } - Replace(result,'$ABI','-mabi='+abitypestr[mips_abi]); + Replace(result,'$ABI','-mabi='+gas_abitype(target_info.abi)); { ARCH selection } Replace(result,'$ARCH','-march='+lower(cputypestr[current_settings.cputype])); // Replace(result,'$ARCH','-march=pic32mx -mtune=pic32mx'); diff --git a/compiler/mips/cpuinfo.pas b/compiler/mips/cpuinfo.pas index 68bf5a4649..43484f26fb 100644 --- a/compiler/mips/cpuinfo.pas +++ b/compiler/mips/cpuinfo.pas @@ -19,7 +19,8 @@ Unit CPUInfo; Interface uses - globtype; + globtype, + systems; Type bestreal = double; @@ -47,17 +48,6 @@ Type tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3); - tabitype = - ( - abi_none, - abi_default, - abi_o32, - abi_n32, - abi_o64, - abi_n64, - abi_eabi - ); - Const {# Size of native extended floating point type } extended_size = 8; @@ -92,20 +82,6 @@ Const 'MIPS2','MIPS3' ); - { abi strings as accepted by - GNU assembler in -abi=XXX option } - abitypestr : array[tabitype] of string[4] = - ({ abi_none } '', - { abi_default } '32', - { abi_o32 } '32', - { abi_n32 } 'n32', - { abi_o64 } 'o64', - { abi_n64 } '64', - { abi_eabi } 'eabi' - ); - - mips_abi : tabitype = abi_default; - type tcpuflags=( CPUMIPS_HAS_CMOV, { conditional move instructions (mips4+) } @@ -248,26 +224,6 @@ const level3optimizerswitches = level2optimizerswitches; level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + []; -function SetMipsABIType(const s : string) : boolean; - Implementation -uses - cutils; - -function SetMipsABIType(const s : string) : boolean; - - var - abi : tabitype; - begin - SetMipsABIType:=false; - for abi := low(tabitype) to high(tabitype) do - if (lower(s)=abitypestr[abi]) then - begin - mips_abi:=abi; - SetMipsABIType:=true; - break; - end; - end; - end. diff --git a/compiler/systems.inc b/compiler/systems.inc index b9ec102828..54fb124899 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -389,6 +389,10 @@ ,abi_i386_dynalignedstack ,abi_xtensa_windowed ,abi_xtensa_call0 + ,abi_mips_o32 + ,abi_mips_n32 + ,abi_mips_o64 + ,abi_mips_n64 ); tcgbackend = ( diff --git a/compiler/systems.pas b/compiler/systems.pas index bfb3395978..38b5672842 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -490,7 +490,7 @@ interface (name: 'AIX' ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}), (name: 'DARWIN' ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}), (name: 'ELFV2' ; supported:{$if defined(powerpc64)}true{$else}false{$endif}), - (name: 'EABI' ; supported:{$if defined(arm)}true{$else}false{$endif}), + (name: 'EABI' ; supported:{$if defined(arm) or defined(mips)}true{$else}false{$endif}), (name: 'ARMEB' ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}), (name: 'EABIHF' ; supported:{$if defined(arm)}true{$else}false{$endif}), (name: 'OLDWIN32GNU'; supported:{$ifdef I386}true{$else}false{$endif}), @@ -504,7 +504,11 @@ interface (name: 'RISCV64LPD'; supported:{$if defined(riscv64)}true{$else}false{$endif}), (name: 'LINUX386_SYSV'; supported:{$if defined(i386)}true{$else}false{$endif}), (name: 'WINDOWED'; supported:{$if defined(xtensa)}true{$else}false{$endif}), - (name: 'CALL0'; supported:{$if defined(xtensa)}true{$else}false{$endif}) + (name: 'CALL0'; supported:{$if defined(xtensa)}true{$else}false{$endif}), + (name: 'O32'; supported:{$if defined(mips)}true{$else}false{$endif}), + (name: 'N32'; supported:{$if defined(mips)}true{$else}false{$endif}), + (name: 'O64'; supported:{$if defined(mips)}true{$else}false{$endif}), + (name: 'N64'; supported:{$if defined(mips)}true{$else}false{$endif}) ); cgbackend2str: array[tcgbackend] of ansistring = (