Rename include dir to match the convention:
from `wasm32-wasi` to `wasm-wasi-musl`
Add building stubs which will be used to build and cache WASI
libc sysroot.
I've added more of the ".def" files from mingw. The list is based on all the libraries referenced by the win32metadata project. (see https://github.com/marlersoft/zigwin32).
The reason this is required is for two reasons: 1) the libc
targeting `aarch64` macOS is slightly newer than that targeting
`x86_64`, and 2) `OSAtomic.h` uses relative imports rather than
system-wide imports for accompanying headers which clearly is an
oversight on Apple's part. Until such time when `libkern` headers
between `x86_64` and `aarch64` are identical, this will require a
manual intervention to duplicate the relevant headers between the
respective architectures.
Closes#7356
I did this as a patch to the source rather than passing flags so that
it would intentionally be reverted when we update to the next release of
mingw-w64. At this time if any warnings are still emitted we should find
out why and make sure upstream is aware of the problem.
See #5854
Some tiny tweaks too:
* Use `wasm-freestanding-musl` instead of `wasm32-freestanding-musl`,
making it pointer-size-agnostic.
* Fix trying to build non-existent wasm musl start files.
See ziglang/fetch-them-macos-headers#2 for more details. The path
forward looks like one of the following:
* Ony provide headers for the oldest supported macOS (currently 10.13
but soon to be bumped to 10.14).
* Provide headers for multiple versions, and select based on the Zig
target OS version range minimum.
* Don't try to provide macOS headers.
If we don't tackle the version problem, we would have to re-introduce
the ability to detect and depend on native system headers if we wanted
to support C/C++ code that used newer OS definitions.
This patch also adds support for `#include <mach/mach_time.h>`.
Also related: #5236
these new files are generated by recursively including:
sysexits.h
mach/mach.h
sys/attr.h
sys/mount.h
crt_externs.h
execinfo.h
all of which are depended on by LLVM libraries.