Better support for the WebAssembly (wasm32/wasm64) targets
This MR makes the following just work and Do The Right Thing:
$ apt install clang-15 lld-15 wasi-libc
$ cat <<EOF > printf.c
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("%s\n", "Hello world!");
}
EOF
$ clang-15 -target wasm32-unknown-wasi -o printf printf.c
To accomplish this, several changes were required:
- Ship compiler-rt for the wasm32 and wasm64 targets.
- Patch the upstream sources to default to compiler-rt for these targets. libgcc does not currently exist for WebAssembly in neither Debian nor upstream, and therefore compiler-rt is the only option.
- Patch the upstream sources to support a system-installed (shipped in /usr) in wasi-libc.
BTS bugs #1010932, #1020746 and #1014567 (all by yours truly), as well as the commit messages in the individual commits, describe this in more detail.
This should apply cleanly on the 14 branch as well, and earlier tests of mine with clang 14 were successful.
Future work: libcxx & libcxxabi for wasm32/wasm64 targets