diff options
author | Ayke van Laethem <[email protected]> | 2020-04-01 23:13:16 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-11-04 17:15:38 +0100 |
commit | 403d93560b78a7eb6cc3bc2853d80cb7dfadc239 (patch) | |
tree | acc51a31099783f35b3ea7dbaa82a19c635de025 /.gitmodules | |
parent | b344d657819827d54936c88df6c66c56331ef0b6 (diff) | |
download | tinygo-403d93560b78a7eb6cc3bc2853d80cb7dfadc239.tar.gz tinygo-403d93560b78a7eb6cc3bc2853d80cb7dfadc239.zip |
builder: build static binaries using musl on Linux
This commit adds support for musl-libc and uses it by default on Linux.
The main benefit of it is that binaries are always statically linked
instead of depending on the host libc, even when using CGo.
Advantages:
- The resulting binaries are always statically linked.
- No need for any tools on the host OS, like a compiler, linker, or
libc in a release build of TinyGo.
- This also simplifies cross compilation as no cross compiler is
needed (it's all built into the TinyGo release build).
Disadvantages:
- Binary size increases by 5-6 kilobytes if -no-debug is used. Binary
size increases by a much larger margin when debugging symbols are
included (the default behavior) because musl is built with debugging
symbols enabled.
- Musl does things a bit differently than glibc, and some CGo code
might rely on the glibc behavior.
- The first build takes a bit longer because musl needs to be built.
As an additional bonus, time is now obtained from the system in a way
that fixes the Y2038 problem because musl has been a bit more agressive
in switching to 64-bit time_t.
Diffstat (limited to '.gitmodules')
-rw-r--r-- | .gitmodules | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules index f4138be50..4df14b5ef 100644 --- a/.gitmodules +++ b/.gitmodules @@ -23,3 +23,6 @@ [submodule "lib/stm32-svd"] path = lib/stm32-svd url = https://github.com/tinygo-org/stm32-svd +[submodule "lib/musl"] + path = lib/musl + url = git://git.musl-libc.org/musl |