build Building for debugging... error: link command failed with exit code 1 (use -v to see invocation) clang: warning: argument unused during compilation: '-F/Applications/Xcode.app/ Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks' [Wunused-command-line-argument] ld.lld: error: cannot open crt0.o: No such file or directory ld.lld: error: cannot open /Users/trick/Library/Developer/Toolchains/swift-6.3RELEASE.xctoolchain/usr/lib/clang/21/lib/riscv32-none-none-eabi/ libclang_rt.builtins.a: No such file or directory ld.lld: error: unable to find library -lc clang: error: linker command failed with exit code 1 (use -v to see invocation) [10/11] Linking Application make: *** [build] Error 1 • crt0.oとかlibclang̲rt.biltins.aがないらしい • ̀-nostdlib̀ をつけるとそれ無しでビルドをしてくれるらしい
_ value: Int32, _ count: Int) -> UnsafeMutableRawPointer { let byte = UInt8(truncatingIfNeeded: value) let ptr = dest.assumingMemoryBound(to: UInt8.self) for i in 0..<count { ptr[i] = byte } return dest } @c(memcpy) @inline(never) public func memcpy(_ dest: UnsafeMutableRawPointer, _ src: UnsafeRawPointer, _ count: Int) -> UnsafeMutableRawPointer { let d = dest.assumingMemoryBound(to: UInt8.self) let s = src.assumingMemoryBound(to: UInt8.self) for i in 0..<count { d[i] = s[i] } return dest }
var _sbss: UInt8 @_extern(c, "_ebss") nonisolated(unsafe) var _ebss: UInt8 func clearBSS() { let start = linkerSymbolAddress(&_sbss) let end = linkerSymbolAddress(&_ebss) guard let ptr = UnsafeMutablePointer<UInt8>(bitPattern: start) else { return } var i = 0 while start &+ UInt(i) < end { ptr[i] = 0 // ループで全部ゼロを代入 i &+= 1 } }
• Running Swift without an OS • Managing external dependencies • kishikawakatsumi/tryswift2026 • Getting Started with Embedded Swift Programming from ¥0