Files
tinygo/testdata/errors/linker-flashoverflow.go
T
Ayke van Laethem 2e76cd3687 builder: interpret linker error messages
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-11 01:48:11 -07:00

22 lines
559 B
Go

package main
import "unsafe"
const (
a = "0123456789abcdef" // 16 bytes
b = a + a + a + a + a + a + a + a // 128 bytes
c = b + b + b + b + b + b + b + b // 1024 bytes
d = c + c + c + c + c + c + c + c // 8192 bytes
e = d + d + d + d + d + d + d + d // 65536 bytes
f = e + e + e + e + e + e + e + e // 524288 bytes
)
var s = f
func main() {
println(unsafe.StringData(s))
}
// ERROR: program too large for this chip (flash overflowed by {{[0-9]+}} bytes)
// ERROR: optimization guide: https://tinygo.org/docs/guides/optimizing-binaries/