Repository navigation
Description
Problem
Importing MAP_ANONYMOUS from std::sys::memory works on Linux, Windows, FreeBSD and wasm64 but fails on both macOS targets. The Darwin providers expose only MAP_ANON, although XNU defines MAP_ANONYMOUS as its alias. Shared allocation code therefore needs an unnecessary target-specific import.
Starting points: std/sys/macos/amd64/memory.wave, std/sys/macos/arm64/memory.wave, std/sys/macos/memory.wave, std/sys/memory.wave.
Reproduction
Tested with the checkout compiler/std at 4c3372157d8889fa8bbef0a7ccd2e72aab1c5c6c:
import("audit_std::sys::memory")::{MAP_ANONYMOUS};
fun main() -> i32 { return 0; }
Save as probe.wave and prepare the checkout std alias:
python3 - <<'PYSETUP'
from pathlib import Path
import tempfile
root = Path(tempfile.mkdtemp(prefix="wave-std-audit-"))
for source in Path("std").rglob("*.wave"):
dest = root / source.relative_to("std")
dest.parent.mkdir(parents=True, exist_ok=True)
dest.write_text(source.read_text().replace('"std::', '"audit_std::'))
Path("/tmp/wave-audit-std-path").write_text(str(root))
PYSETUP
audit_std="$(cat /tmp/wave-audit-std-path)"target/debug/wavec build probe.wave --dep "audit_std=$audit_std" --target aarch64-apple-darwin --emit=checkObserved E3001: the module has no symbol MAP_ANONYMOUS. The same failure occurs for x86_64-apple-darwin; Linux amd64, FreeBSD amd64, Windows amd64 and wasm64 controls pass.
Scope
Add the alias through both Darwin architecture providers and the public macOS/portable re-exports. Keep MAP_ANON available and preserve its value.
Difficulty: easy.
Completion criteria
- The same import compiles on macOS amd64 and ARM64 and on the existing control targets.
- MAP_ANONYMOUS equals MAP_ANON on Darwin.
- Existing allocation behavior and imports remain compatible.
Activity