I'm currently trying to cross-compile Swift standard library for WebAssembly target. I've been able to reuse libc++ and musl from emscripten project, but I constantly stumble upon these and similar errors and warnings about unsupported calling convention:
/Users/maxd/Documents/swift-source/swift/include/swift/ABI/Metadata.h:728:3: warning: calling convention 'swiftcall' ignored for this target [-Wignored-attributes] SWIFT_CC(swift) void(SWIFT_CONTEXT HeapObject *); ^ /Users/maxd/Documents/swift-source/swift/include/swift/Runtime/Config.h:171:22: note: expanded from macro 'SWIFT_CC' #define SWIFT_CC(CC) SWIFT_CC_##CC ^ <scratch space>:66:1: note: expanded from here SWIFT_CC_swift ^ /Users/maxd/Documents/swift-source/swift/include/swift/Runtime/Config.h:182:39: note: expanded from macro 'SWIFT_CC_swift' #define SWIFT_CC_swift __attribute__((swiftcall)) ^ In file included from /Users/maxd/Documents/swift-source/swift/stdlib/public/runtime/Heap.cpp:19: In file included from /Users/maxd/Documents/swift-source/swift/stdlib/public/runtime/Private.h:22: In file included from /Users/maxd/Documents/swift-source/swift/include/swift/Runtime/Metadata.h:20: /Users/maxd/Documents/swift-source/swift/include/swift/ABI/Metadata.h:728:50: error: 'swift_context' parameter can only be used with swiftcall calling convention SWIFT_CC(swift) void(SWIFT_CONTEXT HeapObject *);
I find that
WebAssemblyTargetInfo from LLVM does not override
checkCallingConvention function from
TargetInfo superclass, which causes issuing warnings for all non-C calling conventions. I guess ignoring those warnings is ok at this stage, but
SWIFT_CONTEXT macros cause actual errors.
Does this mean that
swiftcall calling convention should be implemented after all for this target, or is there a workaround for
SWIFT_CONTEXT errors when ignoring
swiftcall CC absence warnings?