builder: add strlen to wasm builtins

LLVM 22 can replace string-scanning loops with calls to strlen during
optimization. Add the implementation to wasmbuiltins and invalidate
cached archives.

Add an optimized wasm-unknown smoke test that exercises the reflect
name-decoding path which exposed the missing symbol.
This commit is contained in:
Jake Bailey
2026-08-29 23:45:30 -07:00
committed by Ron Evans
parent 61c315cbfb
commit fc0673430d
4 changed files with 24 additions and 7 deletions
+2 -2
View File
@@ -43,11 +43,11 @@ var libWasmBuiltins = Library{
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/wasi-libc") },
librarySources: func(target string, _ bool) ([]string, error) {
return []string{
// memory builtins needed for llvm.memcpy.*, llvm.memmove.*, and
// llvm.memset.* LLVM intrinsics.
// Memory builtins needed for LLVM intrinsics and library calls.
"libc-top-half/musl/src/string/memcpy.c",
"libc-top-half/musl/src/string/memmove.c",
"libc-top-half/musl/src/string/memset.c",
"libc-top-half/musl/src/string/strlen.c",
// exp, exp2, and log are needed for LLVM math builtin functions
// like llvm.exp.*.