diff --git a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h index c6e63fac8e..1a7eb3e073 100644 --- a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h +++ b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h @@ -66,6 +66,11 @@ #include #elif TARGET_OS_WASI #include +// Define _WASI_EMULATED_MMAN here to use the emulated mman functions in +// Foundation-side without requiring transitive clients to define it. +#undef _WASI_EMULATED_MMAN +#define _WASI_EMULATED_MMAN +#include #elif TARGET_OS_LINUX #include #include diff --git a/Sources/Foundation/Data.swift b/Sources/Foundation/Data.swift index b76fef915c..9e5c9faf38 100644 --- a/Sources/Foundation/Data.swift +++ b/Sources/Foundation/Data.swift @@ -36,11 +36,6 @@ @usableFromInline let memcpy = Musl.memcpy @usableFromInline let memcmp = Musl.memcmp #elseif canImport(WASILibc) -#if swift(>=6.0) -private import wasi_emulated_mman -#else -import wasi_emulated_mman -#endif @usableFromInline let calloc = WASILibc.calloc @usableFromInline let malloc = WASILibc.malloc @usableFromInline let free = WASILibc.free diff --git a/Sources/Foundation/FileHandle.swift b/Sources/Foundation/FileHandle.swift index 5fb7258ca8..6307b300d7 100644 --- a/Sources/Foundation/FileHandle.swift +++ b/Sources/Foundation/FileHandle.swift @@ -29,7 +29,6 @@ fileprivate let _write = Musl.write(_:_:_:) fileprivate let _close = Musl.close(_:) #elseif canImport(WASILibc) import WASILibc -@_implementationOnly import wasi_emulated_mman fileprivate let _read = WASILibc.read(_:_:_:) fileprivate let _write = WASILibc.write(_:_:_:) fileprivate let _close = WASILibc.close(_:)