diff --git a/compiler/aasmdata.pas b/compiler/aasmdata.pas index 1dd68c3e32..0c9d323999 100644 --- a/compiler/aasmdata.pas +++ b/compiler/aasmdata.pas @@ -298,7 +298,7 @@ implementation for hal:=low(TAsmListType) to high(TAsmListType) do AsmLists[hal]:=TAsmList.create; { PIC data } - if (target_info.system in [system_powerpc_darwin,system_powerpc64_darwin,system_i386_darwin]) then + if (target_info.system in [system_powerpc_darwin,system_powerpc64_darwin,system_i386_darwin,system_arm_darwin]) then AsmLists[al_picdata].concat(tai_directive.create(asd_non_lazy_symbol_pointer,'')); { CFI } FAsmCFI:=CAsmCFI.Create; diff --git a/compiler/aggas.pas b/compiler/aggas.pas index 5bca6e929d..8e5c000a65 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -361,7 +361,8 @@ implementation system_powerpc_darwin, system_i386_darwin, system_powerpc64_darwin, - system_x86_64_darwin: + system_x86_64_darwin, + system_arm_darwin: begin if (atype = sec_stub) then AsmWrite('.section '); @@ -390,6 +391,8 @@ implementation system_i386_darwin: AsmWriteln('__IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5'); { darwin/x86-64 uses RIP-based GOT addressing } + system_arm_darwin: + AsmWriteln('.section __TEXT,__picsymbolstub4,symbol_stubs,none,16'); else internalerror(2006031101); end; diff --git a/compiler/arm/cputarg.pas b/compiler/arm/cputarg.pas index 43bf9b4957..fa005ff686 100644 --- a/compiler/arm/cputarg.pas +++ b/compiler/arm/cputarg.pas @@ -56,6 +56,9 @@ implementation {$ifndef NOTARGETSYMBIAN} ,t_symbian {$endif} + {$ifndef NOTARGETBSD} + ,t_bsd + {$endif} {************************************** Assemblers diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index e9be0183ce..8c289d4727 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -3826,7 +3826,8 @@ implementation case target_info.system of system_powerpc_darwin, system_i386_darwin, - system_powerpc64_darwin: + system_powerpc64_darwin, + system_arm_darwin: begin l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr'); if not(assigned(l)) then diff --git a/compiler/symdef.pas b/compiler/symdef.pas index d1589edc3a..d7cfcfe9c8 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -1504,7 +1504,7 @@ implementation function torddef.alignment:shortint; begin - if (target_info.system = system_i386_darwin) and + if (target_info.system in [system_i386_darwin,system_arm_darwin]) and (ordtype in [s64bit,u64bit]) then result := 4 else @@ -1630,7 +1630,7 @@ implementation function tfloatdef.alignment:shortint; begin - if (target_info.system = system_i386_darwin) then + if (target_info.system in [system_i386_darwin,system_arm_darwin]) then case floattype of s80real : result:=16; s64real, diff --git a/compiler/systems.pas b/compiler/systems.pas index 9c5dcf44b2..42634d13c2 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -144,7 +144,8 @@ interface system_arm_symbian, { 60 } system_x86_64_darwin, { 61 } system_avr_embedded, { 62 } - system_i386_haiku { 63 } + system_i386_haiku, { 63 } + system_arm_darwin { 64 } ); type @@ -395,7 +396,8 @@ interface { all darwin systems } systems_darwin = [system_powerpc_darwin,system_i386_darwin, - system_powerpc64_darwin,system_x86_64_darwin]; + system_powerpc64_darwin,system_x86_64_darwin, + system_arm_darwin]; { all systems supporting exports from programs or units } system_unit_program_exports = [system_i386_win32, @@ -924,11 +926,22 @@ begin {$ifdef cpuarm} default_target(source_info.system); {$else cpuarm} - {$ifdef WINDOWS} - default_target(system_arm_wince); - {$else WINDOWS} - default_target(system_arm_linux); - {$endif WINDOWS} + {$ifdef WINDOWS} + {$define default_target_set} + default_target(system_arm_wince); + {$endif} + {$ifdef linux} + {$define default_target_set} + default_target(system_arm_linux); + {$endif} + {$ifdef darwin} + {$define default_target_set} + default_target(system_arm_darwin); + {$endif} + {$ifndef default_target_set} + default_target(system_arm_linux); + {$define default_target_set} + {$endif} {$endif cpuarm} {$endif arm} diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas index 0993571fb2..805d66e006 100644 --- a/compiler/systems/i_bsd.pas +++ b/compiler/systems/i_bsd.pas @@ -660,6 +660,64 @@ unit i_bsd; ); + system_arm_darwin_info : tsysteminfo = + ( + system : system_arm_darwin; + name : 'Darwin for ARM'; + shortname : 'Darwin'; + flags : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default,tf_has_winlike_resources]; + cpu : cpu_arm; + unit_env : 'BSDUNITS'; + extradefines : 'UNIX;BSD;HASUNIX;CPUARMEL'; + exeext : ''; + defext : '.def'; + scriptext : '.sh'; + smartext : '.sl'; + unitext : '.ppu'; + unitlibext : '.ppl'; + asmext : '.s'; + objext : '.o'; + resext : '.res'; + resobjext : '.or'; + sharedlibext : '.dylib'; + staticlibext : '.a'; + staticlibprefix : 'libp'; + sharedlibprefix : 'lib'; + sharedClibext : '.dylib'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : 'lib'; + Cprefix : '_'; + newline : #10; + dirsep : '/'; + assem : as_darwin; + assemextern : as_darwin; + link : nil; + linkextern : nil; + ar : ar_gnu_ar; + res : res_macho; + dbg : dbg_dwarf2; + script : script_unix; + endian : endian_little; + alignment : + ( + procalign : 4; + loopalign : 4; + jumpalign : 0; + constalignmin : 0; + constalignmax : 8; + varalignmin : 0; + varalignmax : 8; + localalignmin : 4; + localalignmax : 8; + recordalignmin : 0; + recordalignmax : 8; + maxCrecordalign : 8 + ); + first_parm_offset : 8; + stacksize : 262144; + abi : abi_eabi + ); implementation @@ -703,5 +761,10 @@ initialization {$ifdef Darwin} set_source_info(system_powerpc64_darwin_info); {$endif Darwin} +{$ifdef cpuarm} + {$ifdef Darwin} + set_source_info(system_arm_darwin_info); + {$endif Darwin} +{$endif cpuarm} {$endif powerpc64} end. diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index 42267681f8..a182c118fa 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -317,6 +317,8 @@ begin LinkRes.Add('ppc64'); system_x86_64_darwin: LinkRes.Add('x86_64'); + system_arm_darwin: + LinkRes.Add('arm'); end; end; end; @@ -762,6 +764,12 @@ initialization RegisterExport(system_powerpc64_darwin,texportlibdarwin); RegisterTarget(system_powerpc64_darwin_info); {$endif powerpc64} +{$ifdef arm} + RegisterExternalLinker(system_arm_darwin_info,TLinkerBSD); + RegisterImport(system_arm_darwin,timportlibdarwin); + RegisterExport(system_arm_darwin,texportlibdarwin); + RegisterTarget(system_arm_darwin_info); +{$endif arm} RegisterRes(res_elf_info,TWinLikeResourceFile); RegisterRes(res_macho_info,TWinLikeResourceFile);