Skip to content

Commit 3d08a9f

Browse files
MaxDesiatovkateinoigakukun
authored andcommitted
Make SymbolLookup.swift compilable for wasm (#16)
`SymbolLookup.swift` was added recently, which broke our builds after rebasing on top of Apple's `master`. Using anything from this file wouldn't make sense on WebAssembly. It looks there are no codepaths that would call it on that platform, but there are still references to it around, so it has to be at least compilable.
1 parent dbd6ee5 commit 3d08a9f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: stdlib/private/StdlibUnittest/SymbolLookup.swift

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
1414
import Darwin
15-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
15+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(Wasm)
1616
import Glibc
1717
#elseif os(Windows)
1818
import MSVCRT
@@ -23,7 +23,7 @@
2323

2424
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
2525
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
26-
#elseif os(Linux)
26+
#elseif os(Linux) || os(Wasm)
2727
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: 0)
2828
#elseif os(Android)
2929
#if arch(arm) || arch(i386)
@@ -43,6 +43,8 @@ public func pointerToSwiftCoreSymbol(name: String) -> UnsafeMutableRawPointer? {
4343
#if os(Windows)
4444
return unsafeBitCast(GetProcAddress(hStdlibCore, name),
4545
to: UnsafeMutableRawPointer?.self)
46+
#elseif os(Wasm)
47+
fatalError("\(#function) is not supported on WebAssembly")
4648
#else
4749
return dlsym(RTLD_DEFAULT, name)
4850
#endif

0 commit comments

Comments
 (0)