From 5cf455248fcc6ee70368fba40082c23281c20d0d Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 31 Jul 2026 15:04:23 -0700 Subject: [PATCH] all: remove stale picolibc workarounds --- builder/picolibc.go | 21 ++------------------- main_test.go | 2 +- make/test.mk | 3 --- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/builder/picolibc.go b/builder/picolibc.go index 7fb71a724..f6712a5cd 100644 --- a/builder/picolibc.go +++ b/builder/picolibc.go @@ -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", diff --git a/main_test.go b/main_test.go index 17b2b5a57..c32ceacd1 100644 --- a/main_test.go +++ b/main_test.go @@ -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/": diff --git a/make/test.mk b/make/test.mk index d1fc4f263..cf0e99f4a 100644 --- a/make/test.mk +++ b/make/test.mk @@ -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))