Re:Taylor – Swift on bare metal
by gilgoomesh on Monday September 05, 2016 @11:20PM
(#12433462)
It builds Swift without any standard library, runtime or linkage to other components. This isn't normally possible with the Swift compiler.
The solution doesn't involve changing the compiler or building everything into the executable. Instead, this is a makefile coordinated pipeline (front-end swiftc, back-end clang) plus a start.s and a system.c file that omit any need for typical standard library components in the first place.
i.e. a "bare metal" compilation
Without the swift standard library, what can be done? Doesn't the standard library include all of the basic types, like Array, Int, etc?
Fixed-size integers and UnsafeMutablePointer are supported, so it is basically C with different syntax:
Except it has a stronger type checking and safety.
sounds good, what's the draw back like?
Re:Taylor – Swift on bare metal
by TheHydroImpulse on Monday September 05, 2016 @11:09PM
(#12433437)
It's not a new implementation so much as compiling Swift for different architectures and environments not supported by the compiler.
It still uses the Swift compiler but emits LLVM IR and then uses Clang to target to the different environments.
The assembler and Makefile are x86 only. I'm not seeing support for other architectures.
It is for running Swift code without an operating system.
It could be used to write a kernel in Swift.
Re:Taylor – Swift on bare metal
by danieleggert on Tuesday September 06, 2016 @03:10AM
(#12434138)
You can use swiftc (the Swift compiler) without Xcode just like you can use clang without Xcode. Xcode is just an IDE.
EDIT: Clicking through the source I found about a dozen files in total, mostly scripts and make files.