Skip to content

Commit

Permalink
Make SymbolLookup.swift compilable for wasm (#16)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
MaxDesiatov authored and kateinoigakukun committed Dec 14, 2019
1 parent 5abfb45 commit 6c240af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions stdlib/private/StdlibUnittest/SymbolLookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(Wasm)
import Glibc
#elseif os(Windows)
import MSVCRT
Expand All @@ -23,7 +23,7 @@

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
#elseif os(Linux)
#elseif os(Linux) || os(Wasm)
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: 0)
#elseif os(Android)
#if arch(arm) || arch(i386)
Expand All @@ -43,6 +43,8 @@ public func pointerToSwiftCoreSymbol(name: String) -> UnsafeMutableRawPointer? {
#if os(Windows)
return unsafeBitCast(GetProcAddress(hStdlibCore, name),
to: UnsafeMutableRawPointer?.self)
#elseif os(Wasm)
fatalError("\(#function) is not supported on WebAssembly")
#else
return dlsym(RTLD_DEFAULT, name)
#endif
Expand Down

0 comments on commit 6c240af

Please sign in to comment.