Previously we used the --export-all linker flag to export most
functions. However, this is not needed and possibly increases binary
size. Instead, we should be exporting the specific functions to be
exported.
This way is more consistent with how picolibc is specified and allows
generating a helpful error message. This error message should never be
generated for TinyGo binary releases, only when doing local development.
This allows CGo code to call some libc functions. Additionally, by
putting memset/memmove/memcpy in an archive they're not included anymore
when not necessary, reducing code size for small programs.
This makes sure that a stack overflow will cause a "memory access out of
bounds" error instead of a corruption of a global variable.
Here is more background on a very similar stack overflow protection:
https://blog.japaric.io/stack-overflow-protection/
This commit does a few things:
* remove the -8 suffix on macOS, where it is not necessary
* add smoke tests for compiling wasm files on Linux and macOS
Unfortunately, the olin/cwa emulator does not handle floats correctly.
Node.js does, and because it is also supported by the Go WebAssembly
implementation it has better support in general.
When building statically against LLVM, LLD is also included now. When
included, the built in wasm-ld will automatically be used instead of the
external command.
There is also support for linking ELF files but because lld does not
fully support armv6m this is not yet enabled (it produces a warning).
Undefined symbols will be shown by the embedder, for example when
running generated wasm files in a browser.
In the future, this should probably become a fixed list again. But for
experimenting it's easier now to just ignore undefined symbols and
expect the JS to provide them.