diff --git a/compiler/sparcgen/cpugas.pas b/compiler/sparcgen/cpugas.pas index 17c3a7f5f3..b93030fc7c 100644 --- a/compiler/sparcgen/cpugas.pas +++ b/compiler/sparcgen/cpugas.pas @@ -251,7 +251,42 @@ implementation dollarsign: '$'; ); + as_sparc64_as_info : tasminfo = + ( + id : as_gas; + idtxt : 'AS'; + asmbin : 'as'; +{$ifdef FPC_SPARC_V8_ONLY} + asmcmd : '$PIC -o $OBJ $EXTRAOPT $ASM'; +{$else} + asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM'; +{$endif} + supported_targets : [system_sparc64_linux]; + flags : [af_needar,af_smartlink_sections]; + labelprefix : '.L'; + comment : '# '; + dollarsign: '$'; + ); + + as_sparc64_gas_info : tasminfo = + ( + id : as_ggas; + idtxt : 'GAS'; + asmbin : 'gas'; + asmcmd : '$ARCH $PIC -o $OBJ $EXTRAOPT $ASM'; + supported_targets : [system_sparc64_linux]; + flags : [af_needar,af_smartlink_sections]; + labelprefix : '.L'; + comment : '# '; + dollarsign: '$'; + ); + begin +{$ifdef SPARC} RegisterAssembler(as_SPARC_as_info,TGasSPARC); RegisterAssembler(as_SPARC_gas_info,TGasSPARC); +{$else SPARC} + RegisterAssembler(as_SPARC64_as_info,TGasSPARC); + RegisterAssembler(as_SPARC64_gas_info,TGasSPARC); +{$endif SPARC} end. diff --git a/compiler/systems.inc b/compiler/systems.inc index 57bd22295f..3923f7a679 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -51,7 +51,8 @@ cpu_jvm, { 14 } cpu_i8086, { 15 } cpu_aarch64, { 16 } - cpu_wasm { 17 } + cpu_wasm, { 17 } + cpu_sparc64 { 18 } ); tasmmode= (asmmode_none @@ -175,7 +176,8 @@ system_i8086_win16, { 89 } system_i8086_embedded, { 90 } system_arm_aros, { 91 } - system_wasm_wasm32 { 92 } + system_wasm_wasm32, { 92 } + system_sparc64_linux { 93 } ); type diff --git a/compiler/systems.pas b/compiler/systems.pas index 728e0dab3e..7e5dd09403 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -229,7 +229,7 @@ interface systems_wince = [system_arm_wince,system_i386_wince]; systems_android = [system_arm_android, system_i386_android, system_mipsel_android]; systems_linux = [system_i386_linux,system_x86_64_linux,system_powerpc_linux,system_powerpc64_linux, - system_arm_linux,system_sparc_linux,system_m68k_linux, + system_arm_linux,system_sparc_linux,system_sparc64_linux,system_m68k_linux, system_x86_6432_linux,system_mipseb_linux,system_mipsel_linux,system_aarch64_linux]; systems_dragonfly = [system_x86_64_dragonfly]; systems_freebsd = [system_i386_freebsd, @@ -390,7 +390,7 @@ interface cpu2str : array[TSystemCpu] of string[10] = ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64', 'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086', - 'aarch64', 'wasm'); + 'aarch64', 'wasm', 'sparc64'); abiinfo : array[tabi] of tabiinfo = ( (name: 'DEFAULT'; supported: true), @@ -938,6 +938,20 @@ begin {$endif cpusparc} {$endif sparc} +{$ifdef sparc64} + {$ifdef cpusparc64} + default_target(source_info.system); + {$else cpusparc64} + {$ifdef solaris} + {$define default_target_set} + default_target(system_sparc64_solaris); + {$endif} + {$ifndef default_target_set} + default_target(system_sparc64_linux); + {$endif ndef default_target_set} + {$endif cpusparc64} +{$endif sparc64} + {$ifdef arm} {$ifdef cpuarm} default_target(source_info.system); diff --git a/compiler/systems/i_linux.pas b/compiler/systems/i_linux.pas index 7ffa6b21c6..79ed6be105 100644 --- a/compiler/systems/i_linux.pas +++ b/compiler/systems/i_linux.pas @@ -491,6 +491,73 @@ unit i_linux; llvmdatalayout : 'E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64'; ); + system_sparc64_linux_info : tsysteminfo = + ( + system : system_SPARC64_Linux; + name : 'Linux for SPARC64'; + shortname : 'Linux'; + flags : [tf_needs_symbol_size,tf_library_needs_pic,tf_smartlink_sections, + tf_needs_symbol_type,tf_files_case_sensitive, + tf_pic_uses_got, + tf_requires_proper_alignment,tf_safecall_exceptions, tf_safecall_clearstack, + tf_has_winlike_resources]; + cpu : cpu_SPARC64; + unit_env : 'LINUXUNITS'; + extradefines : 'UNIX;HASUNIX'; + exeext : ''; + defext : '.def'; + scriptext : '.sh'; + smartext : '.sl'; + unitext : '.ppu'; + unitlibext : '.ppl'; + asmext : '.s'; + objext : '.o'; + resext : '.res'; + resobjext : '.or'; + sharedlibext : '.so'; + staticlibext : '.a'; + staticlibprefix : 'libp'; + sharedlibprefix : 'lib'; + sharedClibext : '.so'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; + importlibprefix : 'libimp'; + importlibext : '.a'; + Cprefix : ''; + newline : #10; + dirsep : '/'; + assem : as_gas; + assemextern : as_gas; + link : ld_none; + linkextern : ld_linux; + ar : ar_gnu_ar; + res : res_elf; + dbg : dbg_stabs; + script : script_unix; + endian : endian_big; + alignment : + ( + procalign : 16; + loopalign : 8; + jumpalign : 0; + constalignmin : 4; + constalignmax : 16; + varalignmin : 4; + varalignmax : 8; + localalignmin : 4; + localalignmax : 16; + recordalignmin : 0; + recordalignmax : 16; + maxCrecordalign : 16 + ); + first_parm_offset : 92; + stacksize : 16*1024*1024; + stackalign : 16; + abi : abi_default; + llvmdatalayout : 'E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32-S64'; + ); + {$ifdef FPC_ARMHF} system_arm_linux_info : tsysteminfo = ( @@ -988,6 +1055,11 @@ initialization set_source_info(system_sparc_linux_info); {$endif linux} {$endif CPUSPARC} +{$ifdef CPUSPARC64} + {$ifdef linux} + set_source_info(system_sparc64_linux_info); + {$endif linux} +{$endif CPUSPARC64} {$ifdef CPUPOWERPC32} {$ifdef linux} set_source_info(system_powerpc_linux_info); diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index 8a43a40677..b0cfdb0fbc 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -1829,6 +1829,11 @@ initialization RegisterExport(system_SPARC_linux,texportliblinux); RegisterTarget(system_SPARC_linux_info); {$endif SPARC} +{$ifdef SPARC64} + RegisterImport(system_SPARC64_linux,timportliblinux); + RegisterExport(system_SPARC64_linux,texportliblinux); + RegisterTarget(system_SPARC64_linux_info); +{$endif SPARC64} {$ifdef ARM} RegisterImport(system_arm_linux,timportliblinux); RegisterExport(system_arm_linux,texportliblinux);