[swift-dev] Proof-of-concept port of Swift for Android

Joe Groff jgroff at apple.com
Wed Dec 9 13:46:29 CST 2015


> On Dec 8, 2015, at 8:57 PM, Chris Lattner via swift-dev <swift-dev at swift.org> wrote:
> 
> On Dec 8, 2015, at 8:50 PM, Zhuowei Z via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
>> I'm currently working on adding support to the Swift compiler to allow it to target Android.
> 
> Cool.  Responding to one specific issue:
> 
>> - What's the role of the special linker script, and what's the purpose of the conformance tables in shared libraries? I've commented the conformance table loading code out on Android; is that why 'print("Hello world")' prints out "String(" infinity?
> 
> The linker script allows the compiler to be able to enumerate conformance tables, which are part of reflection information.  I’m not an expert in this area (Joe Groff or John McCall could better respond) but I would completely believe the are the reason for your print failure.  print is defined as taking an Any, and does a downcast to a protocol, and that is probably failing.

Yes, this is exactly the problem. You'll need some way for the conformance sections from every .o file to be collected into a section of the final binary that the runtime can consult at runtime in swift_conformsToProtocol. Can the existing swift.ld script be adapted to work on Android?

-Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20151209/b1bf4a17/attachment.html>


More information about the swift-dev mailing list