aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder
AgeCommit message (Collapse)Author
2024-11-26builder: add testing for -size=fullAyke van Laethem
This helps to make sure this feature continues to work and we won't accidentally introduce regressions.
2024-11-26builder: fix wasi-libc path names on Windows with -size=fullAyke van Laethem
Without this fix, wasi-libc is listed as follows: 65 0 0 0 | 65 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-bottom-half\sources 14 0 0 0 | 14 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\musl\src\exit 1398 0 0 0 | 1398 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\musl\src\string 1525 0 0 0 | 1525 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\sources With this fix, it's identified as the wasi-libc C library: 3002 0 0 0 | 3002 0 | C wasi-libc
2024-11-26builder: work around bug in DWARF paths in ClangAyke van Laethem
See bug: https://github.com/llvm/llvm-project/issues/117317
2024-11-26builder: fix cache paths in -size=full outputAyke van Laethem
This fixes long paths from the TinyGo cached GOROOT, as can be seen here: code rodata data bss | flash ram | package ------------------------------- | --------------- | ------- 0 5 0 5 | 5 5 | (padding) 148 0 0 5 | 148 5 | (unknown) 76 0 0 0 | 76 0 | /home/ayke/.cache/tinygo/goroot-ce8827882be9dc201bed279a631881177ae124ea064510684a3cf4bb66436e1a/src/device/arm 4 0 0 0 | 4 0 | /home/ayke/.cache/tinygo/goroot-ce8827882be9dc201bed279a631881177ae124ea064510684a3cf4bb66436e1a/src/internal/task They're now attributed to the correct package instead (device/arm and internal/task).
2024-11-21interp: align created globalsAyke van Laethem
Use the alignment from the align attribute of the runtime.alloc call. This is going to be a more accurate alignment, and is typically smaller than the default.
2024-11-20runtime: implement race-free signals using futexesAyke van Laethem
This requires an API introduced in MacOS 11. I think that's fine, since the version before that (MacOS 10.15) is EOL since 2022. Though if needed, we could certainly work around it by using an older and slightly less nice API.
2024-11-20cgo: support errno value as second return parameterAyke van Laethem
Making this work on all targets was interesting but there's now a test in place to make sure this works on all targets that have the CGo test enabled (which is almost all targets).
2024-11-18linux: add runtime.fcntl functionleongross
This is needed for the internal/syscall/unix package. Signed-off-by: leongross <[email protected]>
2024-11-15builder: whitelist temporary directory env var for Clang invocationAyke van Laethem
It looks like this breaks on Windows: https://github.com/tinygo-org/tinygo/issues/4557 I haven't confirmed this is indeed the problem, but it would make sense. And passing through the temporary directory seems like a good idea regardless, there's not much that could break due to that.
2024-11-14runtime: optimize findHeadAyke van Laethem
This is similar to https://github.com/tinygo-org/tinygo/pull/3899, but smaller and hopefully just as efficient. Thanks to @HattoriHanzo031 for starting this work, benchmarking, and for improving the performance of the code even further.
2024-11-07runtime: don't call sleepTicks with a negative durationAyke van Laethem
There are rare cases where this can happen, see for example https://github.com/tinygo-org/tinygo/issues/4568
2024-11-07os: implement StartProcessleongross
Signed-off-by: leongross <[email protected]>
2024-10-25runtime: bump markStackSizeDamian Gryski
Every time we overflow the stack, we have to do a full rescan of the heap. Making this larger means fewer overflows and thus fewer secondary+ heap scans.
2024-10-23runtime: add support for os/signalAyke van Laethem
This adds support for enabling and listening to signals on Linux and MacOS.
2024-10-21goenv: parse patch version, add func Compare to compare two Go version ↵Randy Reddig
strings (#4536) goenv: parse patch version, add func Compare to compare two Go version strings * Parse tests * add Compare function to compare two Go version strings * goenv, builder: parse patch version in Go version string
2024-10-18builder: check for Go toolchain version used to compile TinyGoAyke van Laethem
This shows a much better error message for issues like this one: https://github.com/NixOS/nixpkgs/pull/341170#issuecomment-2359237471 The new error message would be: cannot compile with Go toolchain version go1.23 (TinyGo was built using toolchain version go1.21.4)
2024-10-18builder: remove environment variables when invoking ClangAyke van Laethem
This is a problem on Guix, which sets C_INCLUDE_PATH that is not affected by `-nostdlibinc`. And therefore it affects the build in unintended ways. Removing all environmental variables fixes this issue, and perhaps also other issues caused by Clang being affected by environment variables.
2024-10-07builder: fix sizesDamian Gryski
2024-10-04wasm: add `//go:wasmexport` support (#4451)Ayke
This adds support for the `//go:wasmexport` pragma as proposed here: https://github.com/golang/go/issues/65199 It is currently implemented only for wasip1 and wasm-unknown, but it is certainly possible to extend it to other targets like GOOS=js and wasip2.
2024-10-03builder: keep wasm temporary filesAyke van Laethem
Don't rename them when -work is set, instead update result.Binary each time and leave result.Executable be the linker output (as intended: result.Executable should be the unmodified linker output).
2024-10-02runtime: seed fastrand() with hardware randomnessDamian Gryski
2024-09-24builder: nitsleongross
remove unused job state enum, nits/reformatting Signed-off-by: leongross <[email protected]>
2024-08-17ci: use Go 1.23Ayke van Laethem
2024-08-15builder: os.SEEK_CUR -> io.SeekCurrentDamian Gryski
2024-08-15misspell.csv: add new misspellings; also check in result of 'make spellfix'.Dan Kegel
2024-08-14arm: support softfloat in GOARM environment variableAyke van Laethem
This adds softfloat support to GOARM, as proposed here: https://github.com/golang/go/issues/61588 This is similar to https://github.com/tinygo-org/tinygo/pull/4189 but with a few differences: * It is based on the work to support MIPS softfloat. * It fixes the issue that the default changed to softfloat everywhere. This PR defaults to softfloat on ARMv5 and hardfloat on ARMv6 and ARMv7. * It also compiles the C libraries (compiler-rt, musl) using the same soft/hard floating point support. This is important because otherwise a GOARM=7,softfloat binary could still contain hardware floating point instructions.
2024-08-12GNUmakefile: add spellfix target, use it. (#4387)dkegel-fastly
TODO: Remove the go.mod/go.sum in internal/tools once doing so doesn't break CI (e.g. once we drop support for go 1.19) * builder/cc1as.h: fix typo found by 'make spell' * GNUmakefile: remove exception for inbetween, fix instance now found by 'make spell' * GNUmakefile: remove exception for programmmer, fix instance now found by 'make spell' * go.mod: use updated misspell. GNUmakefile: add spellfix target, use it. * ignore directories properly when invoking spellchecker. * make spell: give internal/tools its own go.mod, as misspell requires newer go * make lint: depend on tools and run the installed revive (which was perhaps implied by the change that added revive to internal/tools, but not required in GNUmakefile until we gave internal/tools its own temporary go.mod) * .github: now that 'make spell' works well, run it from CI * GNUmakefile: make spell now aborts if it finds misspelt words, so what it finds doesn't get lost in CI logs * GNUmakefile: tools: avoid -C option on go generate to make test-llvm15-go119 circleci job happy, see https://cs.opensource.google/go/go/+/2af48cbb7d85e5fdc635e75b99f949010c607786 * internal/tools/go.mod: fix format of go version to leave out patchlevel, else go complains.
2024-08-12mips: add GOMIPS=softfloat supportAyke van Laethem
Previously, the compiler would default to hardfloat. This is not supported by some MIPS CPUs. This took me much longer than it should have because of a quirk in the LLVM Mips backend: if the target-features string is not set (like during LTO), the Mips backend picks the first function in the module and uses that. Unfortunately, in the case of TinyGo this first function is `llvm.dbg.value`, which is an LLVM intrinsic and doesn't have the target-features string. I fixed it by adding a `-mllvm -mattr=` flag to the linker.
2024-08-12compileopts: refactor defaultTarget functionAyke van Laethem
Move triple calculation into defaultTarget. It was separate for historic reasons that no longer apply. Merging the code makes future changes easier (in particular, softfloat support). The new code is actually shorter than the old code even though it has more comments.
2024-08-11builder: interpret linker error messagesAyke van Laethem
This shows nicely formatted error messages for missing symbol names and for out-of-flash, out-of-RAM conditions (on microcontrollers with limited flash/RAM). Unfortunately the missing symbol name errors aren't available on Windows and WebAssembly because the linker doesn't report source locations yet. This is something that I could perhaps improve in LLD.
2024-08-10cgo: add support for printfAyke van Laethem
The C printf function is sometimes needed for C files included using CGo. This commit makes sure they're available on all systems where CGo is fully supported (that is, everywhere except on AVR). For baremetal systems using picolibc, I've picked the integer-only version of printf to save on flash size. We might want to consider providing a way to pick the floating point version instead, if needed.
2024-08-10builtins: add GENERIC_TF_SOURCESAyke van Laethem
This addes GENERIC_TF_SOURCES, which contains long double floating point builtins (80 bit, 128 bit, etc). This is needed for full printf support.
2024-08-07compileopts: add CanonicalArchName to centralize arch detectionAyke van Laethem
It's possible to detect the architecture from the target triple, but there are a number of exceptions that make it unpleasant to use for this purpose. There are just too many weird exceptions (like mips vs mipsel, and armv6m vs thumv6m vs arm64 vs aarch64) so it's better to centralize these to canonical architecture names. I picked the architecture names that happen to match the musl architecture names, because those seem the most natural to me.
2024-08-06ci: don't include prebuilt libraries in the releaseAyke van Laethem
These libraries will be automatically built when needed and cached. The main reason these were needed is for play.tinygo.org, but I've now prebuilt them there directly (so they don't need to be built for every tarball).
2024-07-22all: add linux/mipsle supportAyke van Laethem
This adds linux/mipsle (little endian Mips) support to TinyGo. It also adds experimental linux/mips (big-endian) support. It doesn't quite work yet, some parts of the standard library (like the reflect package) currently seem to assume a little-endian system.
2024-07-21build: add package ID to compiler and optimization error messagesAyke van Laethem
This improves error reporting slightly.
2024-07-13builder: remove workaround for generics race conditionAyke van Laethem
This commit reverts commit 13a8eae0d. It appars that the race has been fixed by https://github.com/golang/tools/commit/db513b091504, which we now use because it fixes another race condition as well. See: https://github.com/tinygo-org/tinygo/issues/4206
2024-07-02wasi preview 2 support (#4027)Damian Gryski
* all: wasip2 support Co-authored-by: Randy Reddig <[email protected]>
2024-06-12all: drop support for Go 1.18Ayke van Laethem
Go 1.18 has been unsupported for quite a while now (the oldest supported version is Go 1.21). But more importantly, the golang.org/x/tools module now requires Go 1.19 or later. So we'll drop this older version.
2024-05-31builder: make sure wasm-opt command line is printed if askedDamian Gryski
2024-05-31builder: keep un-wasm-opt'd .wasm if -work was passedDamian Gryski
2024-05-24LLVM 18 supportAyke van Laethem
2024-04-30Add 'make spell' target, fix what it finds. In .go files, only checks comments.Dan Kegel
2024-03-27all: change references of 'wasi' to 'wasip1'; test hygieneRandy Reddig
2024-03-26builder: add check for error on creating needed directory as suggested by ↵deadprogram
@b0ch3nski Signed-off-by: deadprogram <[email protected]>
2024-03-26wasm-unknown: add math and memory builtins that LLVM needsAyke van Laethem
This new library is needed for wasm targets that aren't WASI and don't need/want a libc, but still need some intrinsics that are generated by LLVM.
2024-03-19wasm: fix symbol table index for archivesAyke van Laethem
The symbol table was generated incorrectly. The correct way is to use the custom linking WebAssembly section, which I implemented in go-wasm for this purpose. This fixes https://github.com/tinygo-org/tinygo/issues/4114 and is a prerequisite for https://github.com/tinygo-org/tinygo/pull/4176.
2024-03-19all: move -panic=trap support to the compiler/runtimeAyke van Laethem
Support for `-panic=trap` was previously a pass in the optimization pipeline. This change moves it to the compiler and runtime, which in my opinion is a much better place. As a side effect, it also fixes https://github.com/tinygo-org/tinygo/issues/4161 by trapping inside runtime.runtimePanicAt and not just runtime.runtimePanic. This change also adds a test for the list of imported functions. This is a more generic test where it's easy to add more tests for WebAssembly file properties, such as exported functions.
2024-02-17builder: add 'wasm-unknown' to list of targets for clang features verificationdeadprogram
Signed-off-by: deadprogram <[email protected]>
2024-01-31Allow larger systems to have a larger max stack allocDamian Gryski
Fixes #3331