mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-10 14:39:31 +00:00
all: remove stale picolibc workarounds
This commit is contained in:
+2
-19
@@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/tinygo-org/tinygo/goenv"
|
"github.com/tinygo-org/tinygo/goenv"
|
||||||
)
|
)
|
||||||
@@ -25,16 +24,13 @@ var libPicolibc = Library{
|
|||||||
"-Werror",
|
"-Werror",
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-std=gnu11",
|
"-std=gnu11",
|
||||||
"-D_COMPILING_NEWLIB",
|
|
||||||
"-D_HAVE_ALIAS_ATTRIBUTE",
|
|
||||||
"-D__TINY_STDIO",
|
"-D__TINY_STDIO",
|
||||||
"-D_XOPEN_SOURCE=700",
|
"-D_XOPEN_SOURCE=700",
|
||||||
"-DPOSIX_IO",
|
|
||||||
"-D__IO_DEFAULT='i'", // use __i_vfprintf and __i_vfscanf by default
|
"-D__IO_DEFAULT='i'", // use __i_vfprintf and __i_vfscanf by default
|
||||||
"-D__IEEE_LIBM",
|
"-D__IEEE_LIBM",
|
||||||
"-D__OBSOLETE_MATH_FLOAT=1", // use old math code that doesn't expect a FPU
|
"-D__OBSOLETE_MATH_FLOAT=1", // use old math code that doesn't expect a FPU
|
||||||
"-D__OBSOLETE_MATH_DOUBLE=0",
|
"-D__OBSOLETE_MATH_DOUBLE=0",
|
||||||
"-D_WANT_IO_C99_FORMATS",
|
"-D__IO_C99_FORMATS",
|
||||||
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
|
"-D__PICOLIBC_ERRNO_FUNCTION=__errno_location",
|
||||||
"-nostdlibinc",
|
"-nostdlibinc",
|
||||||
"-isystem", picolibcDir + "/libc/include",
|
"-isystem", picolibcDir + "/libc/include",
|
||||||
@@ -46,17 +42,7 @@ var libPicolibc = Library{
|
|||||||
},
|
},
|
||||||
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/picolibc") },
|
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/picolibc") },
|
||||||
librarySources: func(target string, _ bool) ([]string, error) {
|
librarySources: func(target string, _ bool) ([]string, error) {
|
||||||
sources := append([]string(nil), picolibcSources...)
|
return append([]string(nil), picolibcSources...), nil
|
||||||
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
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,10 +151,7 @@ var picolibcSources = []string{
|
|||||||
"libc/string/wmempcpy.c",
|
"libc/string/wmempcpy.c",
|
||||||
"libc/string/wmemset.c",
|
"libc/string/wmemset.c",
|
||||||
"libc/string/xpg_strerror_r.c",
|
"libc/string/xpg_strerror_r.c",
|
||||||
}
|
|
||||||
|
|
||||||
// Parts of picolibc that are too large for small AVRs.
|
|
||||||
var picolibcSourcesLarge = []string{
|
|
||||||
// srcs_stdio
|
// srcs_stdio
|
||||||
"libc/stdio/asprintf.c",
|
"libc/stdio/asprintf.c",
|
||||||
"libc/stdio/bufio.c",
|
"libc/stdio/bufio.c",
|
||||||
|
|||||||
+1
-1
@@ -371,7 +371,7 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
case "math.go":
|
case "math.go":
|
||||||
// Needs newer picolibc version (for sqrt).
|
// LLVM fails to lower one of the required library calls.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
case "cgo/":
|
case "cgo/":
|
||||||
|
|||||||
@@ -153,8 +153,6 @@ TEST_PACKAGES_NONWASM = \
|
|||||||
#
|
#
|
||||||
# * No filesystem is available, so packages like compress/zlib can't be tested
|
# * No filesystem is available, so packages like compress/zlib can't be tested
|
||||||
# (just like wasm).
|
# (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
|
# * Since Go 1.27 the crypto tests below go through cryptotest.TestHash, which
|
||||||
# calls cryptotest.BoundarySlices. These targets report GOOS=linux, so they
|
# calls cryptotest.BoundarySlices. These targets report GOOS=linux, so they
|
||||||
# build boundary.go (//go:build linux || darwin) rather than
|
# 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_NONBAREMETAL = \
|
||||||
$(TEST_PACKAGES_NONWASM) \
|
$(TEST_PACKAGES_NONWASM) \
|
||||||
$(TEST_PACKAGES_NOBOUNDARYSLICES) \
|
$(TEST_PACKAGES_NOBOUNDARYSLICES) \
|
||||||
math \
|
|
||||||
$(nil)
|
$(nil)
|
||||||
|
|
||||||
TEST_PACKAGES_FAST_WASI = $(filter-out $(TEST_PACKAGES_NOWASI), $(TEST_PACKAGES_FAST))
|
TEST_PACKAGES_FAST_WASI = $(filter-out $(TEST_PACKAGES_NOWASI), $(TEST_PACKAGES_FAST))
|
||||||
|
|||||||
Reference in New Issue
Block a user