all: remove stale picolibc workarounds

This commit is contained in:
Jake Bailey
2026-07-31 15:04:23 -07:00
committed by Ron Evans
parent e88a14df69
commit 5cf455248f
3 changed files with 3 additions and 23 deletions
+2 -19
View File
@@ -3,7 +3,6 @@ package builder
import (
"os"
"path/filepath"
"strings"
"github.com/tinygo-org/tinygo/goenv"
)
@@ -25,16 +24,13 @@ var libPicolibc = Library{
"-Werror",
"-Wall",
"-std=gnu11",
"-D_COMPILING_NEWLIB",
"-D_HAVE_ALIAS_ATTRIBUTE",
"-D__TINY_STDIO",
"-D_XOPEN_SOURCE=700",
"-DPOSIX_IO",
"-D__IO_DEFAULT='i'", // use __i_vfprintf and __i_vfscanf by default
"-D__IEEE_LIBM",
"-D__OBSOLETE_MATH_FLOAT=1", // use old math code that doesn't expect a FPU
"-D__OBSOLETE_MATH_DOUBLE=0",
"-D_WANT_IO_C99_FORMATS",
"-D__IO_C99_FORMATS",
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
"-nostdlibinc",
"-isystem", picolibcDir + "/libc/include",
@@ -46,17 +42,7 @@ var libPicolibc = Library{
},
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/picolibc") },
librarySources: func(target string, _ bool) ([]string, error) {
sources := append([]string(nil), picolibcSources...)
if !strings.HasPrefix(target, "avr") {
// Small chips without long jumps can't compile many files (printf,
// pow, etc). Therefore exclude those source files for those chips.
// Unfortunately it's difficult to exclude only some chips, so this
// excludes those files on all AVR chips for now.
// More information:
// https://github.com/llvm/llvm-project/issues/67042
sources = append(sources, picolibcSourcesLarge...)
}
return sources, nil
return append([]string(nil), picolibcSources...), nil
},
}
@@ -165,10 +151,7 @@ var picolibcSources = []string{
"libc/string/wmempcpy.c",
"libc/string/wmemset.c",
"libc/string/xpg_strerror_r.c",
}
// Parts of picolibc that are too large for small AVRs.
var picolibcSourcesLarge = []string{
// srcs_stdio
"libc/stdio/asprintf.c",
"libc/stdio/bufio.c",
+1 -1
View File
@@ -371,7 +371,7 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
continue
case "math.go":
// Needs newer picolibc version (for sqrt).
// LLVM fails to lower one of the required library calls.
continue
case "cgo/":
-3
View File
@@ -153,8 +153,6 @@ TEST_PACKAGES_NONWASM = \
#
# * No filesystem is available, so packages like compress/zlib can't be tested
# (just like wasm).
# * picolibc math functions apparently are less precise, the math package
# fails on baremetal.
# * Since Go 1.27 the crypto tests below go through cryptotest.TestHash, which
# calls cryptotest.BoundarySlices. These targets report GOOS=linux, so they
# build boundary.go (//go:build linux || darwin) rather than
@@ -164,7 +162,6 @@ TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL), $(TEST_PAC
TEST_PACKAGES_NONBAREMETAL = \
$(TEST_PACKAGES_NONWASM) \
$(TEST_PACKAGES_NOBOUNDARYSLICES) \
math \
$(nil)
TEST_PACKAGES_FAST_WASI = $(filter-out $(TEST_PACKAGES_NOWASI), $(TEST_PACKAGES_FAST))