+ Darwin/AArch64 support

git-svn-id: trunk@29934 -
This commit is contained in:
Jonas Maebe 2015-02-23 22:53:50 +00:00
parent f54ea490dd
commit 5a8959381c
6 changed files with 38 additions and 34 deletions

View File

@ -30,8 +30,8 @@
{$endif}
{$endif}
{$if (defined(darwin) and defined(cpuarm)) or defined(iphonesim)}
{$define darwinarm}
{$if (defined(darwin) and (defined(cpuarm) or defined(cpuaarch64))) or defined(iphonesim)}
{$define darwin_new_iostructs}
{$endif}
// CONST SYS_NMLN=65;
@ -88,7 +88,7 @@ TYPE
st_qspare2 : cint64;
{$else dragonfly}
st_dev : dev_t; // inode's device
{$ifdef darwinarm}
{$ifdef darwin_new_iostructs}
st_mode : mode_t; // inode protection mode
st_nlink : nlink_t; // number of hard links
st_ino : ino_t; // inode's number
@ -115,7 +115,7 @@ TYPE
st_mtimensec : clong; // nsec of last data modification
st_ctime : time_t; // time of last file status change
st_ctimensec : clong; // nsec of last file status change
{$ifdef darwinarm}
{$ifdef darwin_new_iostructs}
st_birthtime : time_t; // File creation time
st_birthtimensec : clong; // nsec of file creation time
{$endif}
@ -144,7 +144,7 @@ TYPE
pStat = ^stat;
{ directory services }
{$ifndef darwinarm}
{$ifndef darwin_new_iostructs}
dirent = record
d_fileno : cuint32; // file number of entry
d_reclen : cuint16; // length of this record
@ -152,7 +152,7 @@ TYPE
d_namlen : cuint8; // length of string in d_name
d_name : array[0..(255 + 1)-1] of char; // name must be no longer than this
end;
{$else not darwinarm}
{$else not darwin_new_iostructs}
{$packrecords 4}
{ available on Mac OS X 10.6 and later, and used by all iPhoneOS versions }
dirent = record
@ -164,7 +164,7 @@ TYPE
d_name : array[0..PATH_MAX-1] of char; // name must be no longer than this
end;
{$packrecords c}
{$endif darwinarm}
{$endif darwin_new_iostructs}
TDirent = dirent;
pDirent = ^dirent;

View File

@ -30,27 +30,21 @@ const
{$ENDIF}
FPCRES_EXT = '.fpcres';
FPCRES_ARCH =
{$IFDEF CPUI386}
{$if defined(cpui386)}
'.i386';
{$ELSE}
{$IFDEF CPUX86_64}
'.x86_64';
{$ELSE}
{$IFDEF CPUPOWERPC32}
'.powerpc';
{$ELSE}
{$IFDEF CPUPOWERPC64}
'.powerpc64';
{$ELSE}
{$IFDEF CPUARM}
'.arm';
{$ELSE}
'';
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$elseif defined(cpux86_64)}
'.x86_64';
{$elseif defined(cpupowerpc32)}
'.powerpc';
{$elseif defined(cpupowerpc64)}
'.powerpc64';
{$elseif defined(cpuarm)}
'.arm';
{$elseif defined(cpuaarch64)}
'.aarch64';
{$else}
{$error add support for cpu architecture}
{$endif}
type
TExtHeader = packed record

View File

@ -35,7 +35,7 @@ type
pGid = ^gid_t;
TIOCtlRequest = cuLong;
{$if not defined(cpuarm) and not defined(iphonesim)}
{$if not defined(cpuarm) and not defined(aarch64) and not defined(iphonesim)}
ino_t = cuint32; { used for file serial numbers }
{$else}
ino_t = cuint64;
@ -144,7 +144,7 @@ type
val: array[0..1] of cint32;
end;
{$if defined(cpuarm) or defined(iphonesim)}
{$if defined(cpuarm) or defined(cpuaarch64) or defined(iphonesim)}
{ structure used on iPhoneOS and available on Mac OS X 10.6 and later }
tstatfs = record
bsize : cuint32;

View File

@ -172,12 +172,16 @@ type
function objc_msgSend(self: id; op: SEL): id; cdecl; varargs; external libname;
function objc_msgSendSuper(const super: pobjc_super; op: SEL): id; cdecl; varargs; external libname;
function objc_msgSendSuper2(const super: pobjc_super; op: SEL): id; cdecl; varargs; weakexternal libname; { Mac OS X 10.6 and later }
{ The following two are declared as procedures with the hidden result pointer
as their first parameter. This corresponds to the declaration below as far
as the code generator is concerned (and is easier to handle in the compiler). }
{ the AArch64 ABI does not require special handling of struct returns, so no
special handlers are provided/required }
{$ifndef cpuaarch64}
{ The following two are declared as procedures with the hidden result pointer
as their first parameter. This corresponds to the declaration below as far
as the code generator is concerned (and is easier to handle in the compiler). }
function objc_msgSend_stret(self: id; op: SEL): tdummyrecbyaddrresult; cdecl; varargs; external libname;
function objc_msgSendSuper_stret(const super: pobjc_super; op: SEL): tdummyrecbyaddrresult; cdecl; varargs; external libname;
function objc_msgSendSuper2_stret(const super: pobjc_super; op: SEL): tdummyrecbyaddrresult; cdecl; varargs; weakexternal libname;
{$endif cpuaarch64}
{ This one actually also exists to return extended on x86_64, but
we don't support that yet
}
@ -230,7 +234,9 @@ type
function class_getInstanceMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
function class_getClassMethod(cls:pobjc_class; name:SEL):Method; cdecl; external libname;
function class_getMethodImplementation(cls:pobjc_class; name:SEL):IMP; cdecl; external libname;
{$ifndef cpuaarch64}
function class_getMethodImplementation_stret(cls:pobjc_class; name:SEL):IMP; cdecl; external libname;
{$endif cpuaarch64}
function class_respondsToSelector(cls:pobjc_class; sel:SEL):BOOL; cdecl; external libname;
function class_copyMethodList(cls:pobjc_class; outCount:pdword):PMethod; cdecl; external libname;

View File

@ -140,6 +140,10 @@ Type PINTRTLEvent = ^TINTRTLEvent;
threadvarblocksize:=align(threadvarblocksize,16);
{$endif cpupowerpc64}
{$ifdef cpuaarch64}
threadvarblocksize:=align(threadvarblocksize,16);
{$endif cpuaarch64}
offset:=threadvarblocksize;
inc(threadvarblocksize,size);

View File

@ -229,12 +229,12 @@ procedure InitThread;
var
transliterate: cint;
iconvindex: longint;
{$if not(defined(darwin) and defined(cpuarm)) and not defined(iphonesim)}
{$if not(defined(darwin) and (defined(cpuarm) or defined(cpuaarch64))) and not defined(iphonesim)}
iconvname: rawbytestring;
{$endif}
begin
current_DefaultSystemCodePage:=DefaultSystemCodePage;
{$if not(defined(darwin) and defined(cpuarm)) and not defined(iphonesim)}
{$if not(defined(darwin) and (defined(cpuarm) or defined(cpuaarch64))) and not defined(iphonesim)}
iconvindex:=GetCodepageData(DefaultSystemCodePage);
if iconvindex<>-1 then
iconvname:=UnixCpMap[iconvindex].name