[GSoC 2017] Porting Swift to Haiku - Week #3

Hello everyone! This is a rather short update on the Swift port and since the last blog post, I’ve worked around a small issue that prevented the compiler from importing libraries by specifying the -sdk parameter with a ‘/’ which passes the correct header search paths to swiftc. This issue also existed on other platforms such as FreeBSD according to this thread in the swift-dev mailing list [1]. Whilst researching around the frequent swift interpreter crashes when opening a swift source file, the fault lies in libswiftCore being unable to extract type metadata from swift-generated dynamic libraries when calling these functions specified in the ProtocolConformance and Metadata classes. It is also evident that whenever swift attempts to load this metadata at runtime, it uses ‘dl_iterate_phdr()’ to iterate over every ELF object loaded into the process address-space and will initiate a callback that will emit internal ELF information defined in the dl_phdr_info* struct. I will spend this week with my mentors to implement a Haiku replacement for this function.


This is a companion discussion topic for the original entry at https://www.haiku-os.org/blog/return0e/2017-06-05_%5Bgsoc_2017%5D_porting_swift_to_haiku_-_week_3/

Thanks for the post.

Maybe have a look at get_next_image_info(), it might provide what you need for dl_iterate_phdr().

I’m certainly excited to see Swift coming to Haiku. :slight_smile: