Skip to content

Commit b757cb5

Browse files
committed
all: remove stale picolibc workarounds
1 parent 121c2be commit b757cb5

3 files changed

Lines changed: 3 additions & 23 deletions

File tree

builder/picolibc.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package builder
33
import (
44
"os"
55
"path/filepath"
6-
"strings"
76

87
"github.com/tinygo-org/tinygo/goenv"
98
)
@@ -25,16 +24,13 @@ var libPicolibc = Library{
2524
"-Werror",
2625
"-Wall",
2726
"-std=gnu11",
28-
"-D_COMPILING_NEWLIB",
29-
"-D_HAVE_ALIAS_ATTRIBUTE",
3027
"-D__TINY_STDIO",
3128
"-D_XOPEN_SOURCE=700",
32-
"-DPOSIX_IO",
3329
"-D__IO_DEFAULT='i'", // use __i_vfprintf and __i_vfscanf by default
3430
"-D__IEEE_LIBM",
3531
"-D__OBSOLETE_MATH_FLOAT=1", // use old math code that doesn't expect a FPU
3632
"-D__OBSOLETE_MATH_DOUBLE=0",
37-
"-D_WANT_IO_C99_FORMATS",
33+
"-D__IO_C99_FORMATS",
3834
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
3935
"-nostdlibinc",
4036
"-isystem", picolibcDir + "/libc/include",
@@ -46,17 +42,7 @@ var libPicolibc = Library{
4642
},
4743
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/picolibc") },
4844
librarySources: func(target string, _ bool) ([]string, error) {
49-
sources := append([]string(nil), picolibcSources...)
50-
if !strings.HasPrefix(target, "avr") {
51-
// Small chips without long jumps can't compile many files (printf,
52-
// pow, etc). Therefore exclude those source files for those chips.
53-
// Unfortunately it's difficult to exclude only some chips, so this
54-
// excludes those files on all AVR chips for now.
55-
// More information:
56-
// https://github.com/llvm/llvm-project/issues/67042
57-
sources = append(sources, picolibcSourcesLarge...)
58-
}
59-
return sources, nil
45+
return append([]string(nil), picolibcSources...), nil
6046
},
6147
}
6248

@@ -165,10 +151,7 @@ var picolibcSources = []string{
165151
"libc/string/wmempcpy.c",
166152
"libc/string/wmemset.c",
167153
"libc/string/xpg_strerror_r.c",
168-
}
169154

170-
// Parts of picolibc that are too large for small AVRs.
171-
var picolibcSourcesLarge = []string{
172155
// srcs_stdio
173156
"libc/stdio/asprintf.c",
174157
"libc/stdio/bufio.c",

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
371371
continue
372372

373373
case "math.go":
374-
// Needs newer picolibc version (for sqrt).
374+
// LLVM fails to lower one of the required library calls.
375375
continue
376376

377377
case "cgo/":

make/test.mk

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ TEST_PACKAGES_NONWASM = \
153153
#
154154
# * No filesystem is available, so packages like compress/zlib can't be tested
155155
# (just like wasm).
156-
# * picolibc math functions apparently are less precise, the math package
157-
# fails on baremetal.
158156
# * Since Go 1.27 the crypto tests below go through cryptotest.TestHash, which
159157
# calls cryptotest.BoundarySlices. These targets report GOOS=linux, so they
160158
# build boundary.go (//go:build linux || darwin) rather than
@@ -164,7 +162,6 @@ TEST_PACKAGES_BAREMETAL = $(filter-out $(TEST_PACKAGES_NONBAREMETAL), $(TEST_PAC
164162
TEST_PACKAGES_NONBAREMETAL = \
165163
$(TEST_PACKAGES_NONWASM) \
166164
$(TEST_PACKAGES_NOBOUNDARYSLICES) \
167-
math \
168165
$(nil)
169166

170167
TEST_PACKAGES_FAST_WASI = $(filter-out $(TEST_PACKAGES_NOWASI), $(TEST_PACKAGES_FAST))

0 commit comments

Comments
 (0)