diff options
author | Ayke van Laethem <[email protected]> | 2022-11-04 14:50:26 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-11-06 09:05:05 +0100 |
commit | df888acd5eff0eb5a70ef87ba083f0f15737d120 (patch) | |
tree | f83101a0e4b7fbdfa0ecc36794478ba3888c24a8 /builder | |
parent | b9bb605257a0faa128dd7e07a9bb32a7bbf28d9a (diff) | |
download | tinygo-df888acd5eff0eb5a70ef87ba083f0f15737d120.tar.gz tinygo-df888acd5eff0eb5a70ef87ba083f0f15737d120.zip |
avr: drop GNU toolchain dependency
- Use compiler-rt and picolibc instead of avr-libc.
- Use ld.lld instead of avr-ld (or avr-gcc).
This makes it much easier to get started with TinyGo on AVR because
installing these extra tools (gcc-avr, avr-libc) can be a hassle.
It also opens the door for future improvements such as ThinLTO.
There is a code size increase but I think it's worth it in the long run.
The code size increase can hopefully be reduced with improvements to the
LLVM AVR backend and to compiler-rt.
Diffstat (limited to 'builder')
-rw-r--r-- | builder/builtins.go | 12 | ||||
-rw-r--r-- | builder/picolibc.go | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/builder/builtins.go b/builder/builtins.go index f35816148..a1066b671 100644 --- a/builder/builtins.go +++ b/builder/builtins.go @@ -162,6 +162,15 @@ var aeabiBuiltins = []string{ "udivmodsi4.c", } +var avrBuiltins = []string{ + "avr/divmodhi4.S", + "avr/divmodqi4.S", + "avr/mulhi3.S", + "avr/mulqi3.S", + "avr/udivmodhi4.S", + "avr/udivmodqi4.S", +} + // CompilerRT is a library with symbols required by programs compiled with LLVM. // These symbols are for operations that cannot be emitted with a single // instruction or a short sequence of instructions for that target. @@ -186,6 +195,9 @@ var CompilerRT = Library{ if strings.HasPrefix(target, "arm") || strings.HasPrefix(target, "thumb") { builtins = append(builtins, aeabiBuiltins...) } + if strings.HasPrefix(target, "avr") { + builtins = append(builtins, avrBuiltins...) + } return builtins, nil }, } diff --git a/builder/picolibc.go b/builder/picolibc.go index d64ed48b7..1b7c748be 100644 --- a/builder/picolibc.go +++ b/builder/picolibc.go @@ -78,7 +78,7 @@ var picolibcSources = []string{ "libc/tinystdio/fputc.c", "libc/tinystdio/fputs.c", "libc/tinystdio/fread.c", - "libc/tinystdio/freopen.c", + //"libc/tinystdio/freopen.c", // crashes with AVR, see: https://github.com/picolibc/picolibc/pull/369 "libc/tinystdio/fscanf.c", "libc/tinystdio/fseek.c", "libc/tinystdio/fseeko.c", |