Open dreampiggy opened 1 year ago
- However, actually dyld will use shared cache instead of actually load that
swift-5.9.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib
It seems that the code you highlight in the screenshot will not be executed on macOS since it was guarded by _WIN32
Description
Use Swift 5.9 toolchain (xctoolchain)'s swift binary, to run Swift code in interpret mode (means, using
xcrun -toolchain com.foobar swift main.swift
, will cause the compiler crash (with stacktrace below). This can not been reproduced on arm64 M1 mac.The actual compile command is this, in the Xcode's Custom Script build phases:
Some reproducable tip:
SWIFT_SWIFT_PARSER=ON
when compile Swift compiler itself)-interpret
mode, not the normal-c
or-emit-executable
actionSteps to reproduce
main.swift
: main.swift.zipxcrun -toolchain swift
or usingTOOLCHAINS
environment in Xcode, or directly useswift-5.9.xctoolchain/usr/bin/swift
to spawnExpected behavior
The compiler should not crash and interpret the Swift code as normal
Environment
Stack trace from stdout:
Personal guess:
libswiftCore.dylib
, inswift-5.9.xctoolchain/usr/lib/swift/macosx
SWIFT_SWIFT_PARSER=ON
, it try to use LLVM::Orc to JIT the code, and to load the@rpath/libswiftCore.dylib
inswift-frontend
's MachO load commandswift-5.9.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib