[swift-dev] Swift kernel hacking, compiler options and target triples

Simon Evans si at si.org
Mon Mar 28 13:16:06 CDT 2016


Hi

I’ve been experimenting with kernel programming in Swift and this required
disabling the use of the red zone. Currently Im compiling to ELF on Linux and
linking in my own minimal libc/libcpp with libswiftCore.a so its not using any
Linux libraries.

I did a PR for adding a '-disable-red-zone' option but it was suggested to add
a target triple instead of adding extra compiler options so I wanted to
discuss it. I don't think there is a specific target I can currently use so
I thought of adding one. Some suggested names I came up with:

x86_64-none-baremetal
x86_64-elf-none

I don't have a strong preference but I couldnt find anything that really matched
for an ELF kernel with no OS

On a related note about compiler options, what could be done about options such
as enabling/disabling certain instruction sets eg SSE or FP or other such
lowlevel options etc? These wouldn't necessarily always be on or off for a given
target but the programer may want the ability to fine tune for firmware and
embedded etc. Is there anyway this can be accomplished without adding lots of
compiler options? I understand not wanting to go the gcc route of having a large
option list.


Original PR: https://github.com/apple/swift/pull/1893
Experimental kernel: https://github.com/spevans/swift-project1

Thanks


More information about the swift-dev mailing list