ole / swift-rp-pico-bare

Embedded Swift on the Raspberry Pi Pico without the Pico C/C++ SDK
93 stars 3 forks source link

Use swiftc for linking #1

Open ole opened 10 months ago

ole commented 10 months ago

Currently we call Clang to perform the linking. I'd like to switch to swiftc because that's a prerequisite for SwiftPM (I think).

I get an error about a missing usr/lib/swift/armv6m/swiftrt.o when I try:

build/SwiftPico.elf: build/bs2_default_padded_checksummed.S.obj build/crt0.S.obj build/bootrom.c.obj build/pico_int64_ops_aeabi.S.obj build/main.o | build
    "${SWIFTC}" \
        -O \
        -wmo \
        -enable-experimental-feature Embedded \
        -target armv6m-none-none-eabi \
        -Xlinker --script=pico-sdk-comps/memmap_default.ld \
        -Xlinker -z -Xlinker max-page-size=4096 \
        -Xlinker --gc-sections \
        -Xlinker --wrap=__aeabi_lmul \
        $^ \
        -o "$@"
$ make
"/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-12-07-a.xctoolchain/usr/bin/swiftc" \
        -O \
        -wmo \
        -enable-experimental-feature Embedded \
        -target armv6m-none-none-eabi \
        -Xlinker --script=pico-sdk-comps/memmap_default.ld \
        -Xlinker -z -Xlinker max-page-size=4096 \
        -Xlinker --gc-sections \
        -Xlinker --wrap=__aeabi_lmul \
        build/bs2_default_padded_checksummed.S.obj build/crt0.S.obj build/bootrom.c.obj build/pico_int64_ops_aeabi.S.obj build/main.o \
        -o "build/SwiftPico.elf"
error: link command failed with exit code 1 (use -v to see invocation)
clang: error: no such file or directory: '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2023-12-07-a.xctoolchain/usr/lib/swift/armv6m/swiftrt.o'
clang: error: invalid linker name in argument '-fuse-ld=gold'
error: fatalError
make: *** [build/SwiftPico.elf] Error 1