From ca80c52df19855074b8503165acf04bbe64e26bf Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 26 Nov 2024 11:12:07 +0100 Subject: [PATCH] builder: fix wasi-libc path names on Windows with -size=full Without this fix, wasi-libc is listed as follows: 65 0 0 0 | 65 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-bottom-half\sources 14 0 0 0 | 14 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\musl\src\exit 1398 0 0 0 | 1398 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\musl\src\string 1525 0 0 0 | 1525 0 | C:\Users\Ayke\src\tinygo\tinygo\lib\wasi-libc\libc-top-half\sources With this fix, it's identified as the wasi-libc C library: 3002 0 0 0 | 3002 0 | C wasi-libc --- builder/sizes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builder/sizes.go b/builder/sizes.go index 7863bbae0..3f6cc4518 100644 --- a/builder/sizes.go +++ b/builder/sizes.go @@ -200,6 +200,11 @@ func readProgramSizeFromDWARF(data *dwarf.Data, codeOffset, codeAlignment uint64 // Work around a Clang bug on Windows: // https://github.com/llvm/llvm-project/issues/117317 path = strings.ReplaceAll(path, "\\\\", "\\") + + // wasi-libc likes to use forward slashes, but we + // canonicalize everything to use backwards slashes as + // is common on Windows. + path = strings.ReplaceAll(path, "/", "\\") } line := addressLine{ Address: prevLineEntry.Address + codeOffset,