www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - iOS arm64 support coming along nicely

reply Dan Olson <gorox comcast.net> writes:
Having a free day on Monday and a recently acquired iPhone 6, I started
adding support for iOS arm64 to LDC.  So far going smoothly with
druntime compiling, Threads and Fiber switching working on the h/w.  TLS
functions with same approach as 32-bit ARM: a small modification to LLVM
that works with [1].

Next task is to fix up the C ABI as iOS calling convention [2] is a
variation on AAPCS64.  Started with LDC's gen/abi-aarch64.cpp, but a
couple files of phobos ICE in LLVM vararg code, which I expect is due to
iOS variation.

[1] https://github.com/smolt/iphoneos-apple-support 
[2] https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html

-- 
Dan
Sep 08 2015
next sibling parent reply "ChangLong" <changlon gmail.com> writes:
On Tuesday, 8 September 2015 at 15:52:11 UTC, Dan Olson wrote:
 Having a free day on Monday and a recently acquired iPhone 6, I 
 started adding support for iOS arm64 to LDC.  So far going 
 smoothly with druntime compiling, Threads and Fiber switching 
 working on the h/w.  TLS functions with same approach as 32-bit 
 ARM: a small modification to LLVM that works with [1].

 Next task is to fix up the C ABI as iOS calling convention [2] 
 is a variation on AAPCS64.  Started with LDC's 
 gen/abi-aarch64.cpp, but a couple files of phobos ICE in LLVM 
 vararg code, which I expect is due to iOS variation.

 [1] https://github.com/smolt/iphoneos-apple-support [2] 
 https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
Good work and great news. Do you think app build by LDC can be released in Apple store?
Sep 08 2015
parent Dan Olson <gorox comcast.net> writes:
"ChangLong" <changlon gmail.com> writes:
 Do you think app build by LDC can be released in Apple store?
Yes, eventually. I am sure the review process will find some issues but nothing that can't be fixed. I have a simple game written by my daughter that I may use as a test case once arm64 is ready. -- Dan
Sep 09 2015
prev sibling parent reply Dan Olson <gorox comcast.net> writes:
Dan Olson <gorox comcast.net> writes:

 Next task is to fix up the C ABI as iOS calling convention [2] is a
 variation on AAPCS64.  Started with LDC's gen/abi-aarch64.cpp, but a
 couple files of phobos ICE in LLVM vararg code, which I expect is due to
 iOS variation.
All of phobos builds now for arm64 and writeln("hello world") works. Haven't tried much else yet. Getting the C ABI compatible with clang for struct passing will take some more work though. -- Dan
Sep 09 2015
next sibling parent "Jeremy DeHaan" <dehaan.jeremiah gmail.com> writes:
On Wednesday, 9 September 2015 at 16:10:39 UTC, Dan Olson wrote:
 Dan Olson <gorox comcast.net> writes:

 Next task is to fix up the C ABI as iOS calling convention [2] 
 is a variation on AAPCS64.  Started with LDC's 
 gen/abi-aarch64.cpp, but a couple files of phobos ICE in LLVM 
 vararg code, which I expect is due to iOS variation.
All of phobos builds now for arm64 and writeln("hello world") works. Haven't tried much else yet. Getting the C ABI compatible with clang for struct passing will take some more work though.
Fantastic news! Once that is ready I can do some testing with my SFML binding. I've actually been waiting for this to come so I could play around with it.
Sep 10 2015
prev sibling parent reply Dan Olson <gorox comcast.net> writes:
arm64 iOS and iphone sim almost ready!  A few minor changes where needed
but now druntime/phobos unittests are looking good.  It is currently
based on 0.15.2 DMD frontend 2.066 [1].

Unfortunately I got a regression (unaligned load) with previously
working 32-bit armv7 after the varags change in 0.15.2.  I need to sort
that out now.

I haven't pushed necessary LLVM 3.6 arm64 changes yet to github.  Trying
to build ios-merge-release-0.15.2 without the updated LLVM will fail.

[1] https://github.com/smolt/ldc/tree/ios-merge-release-0.15.2

--
Dan
Sep 14 2015
parent reply Dan Olson <gorox comcast.net> writes:
If anybody is feeling adventuresome and wants to try LDC with an arm64
iOS device, I updated the development repo with submodules that support
iOS arm64 and simulator.  I have tested on an iPhone 6 and all
druntime/phobos unittests pass with exception of some math results,
similar to what I documented for armv7.

https://github.com/smolt/ldc-iphone-dev

I haven't updated any of the readme files yet, but the build
instructions still apply.  The differences are that the dev repo will
pull in a llvm 3.6.1 with iOS TLS support, LDC is based on 0.15.2, and
fatlibs with all standard architectures (armv7, armv7s, arm64, i386, and
x86_64) are built for druntime and phobos.
-- 
Dan
Sep 15 2015
parent reply David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
On 15 Sep 2015, at 18:45, Dan Olson via digitalmars-d-ldc wrote:
 I have tested on an iPhone 6 and all
 druntime/phobos unittests pass with exception of some math results,
 similar to what I documented for armv7.
Nice!
 https://github.com/smolt/ldc-iphone-dev

 I haven't updated any of the readme files yet, but the build
 instructions still apply.  The differences are that the dev repo will
 pull in a llvm 3.6.1 with iOS TLS support, LDC is based on 0.15.2, and
 fatlibs with all standard architectures (armv7, armv7s, arm64, i386, 
 and
 x86_64) are built for druntime and phobos.
We should discuss how to best integrate iOS support into mainline LDC (even if it will still require a patched LLVM) soon, especially because DDMD will happen soon. — David
Sep 15 2015
parent reply Dan Olson <gorox comcast.net> writes:
David Nadlinger via digitalmars-d-ldc <digitalmars-d-ldc puremagic.com> writes:
 We should discuss how to best integrate iOS support into mainline LDC
 (even if it will still require a patched LLVM) soon, especially
 because DDMD will happen soon.

  — David
Hi David, the changes. https://github.com/ldc-developers/ldc/issues/1081 It was pretty cool how stuff for arm64 just worked. In particular, exception handling worked out of the box. -- Dan
Sep 16 2015
parent Kai Nacke <kai redstar.de> writes:
On Wednesday, 16 September 2015 at 07:23:05 UTC, Dan Olson wrote:
 It was pretty cool how stuff for arm64 just worked.  In 
 particular, exception handling worked out of the box.
The only missing piece for Linux/AArch64 is the vararg stuff. Everything else should work out of the box, too. Regards, Kai
Sep 16 2015