From de281191e09ae27d1b73214eb289a2a301c8e849 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sun, 5 Mar 2023 20:18:11 +0100 Subject: [PATCH] builder: detect compiler-rt size usage Previously the code size of the compiler-rt library might be displayed like this: ``` 1050 0 0 0 | 1050 0 | /home/ayke/src/tinygo/tinygo/llvm-project/compiler-rt/lib/builtins 146 0 0 0 | 146 0 | /home/ayke/src/tinygo/tinygo/llvm-project/compiler-rt/lib/builtins/arm ``` With this change, it is displayed nicely like this: ``` 1196 0 0 0 | 1196 0 | C compiler-rt ``` --- builder/sizes.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/sizes.go b/builder/sizes.go index dacaec71..35622f1b 100644 --- a/builder/sizes.go +++ b/builder/sizes.go @@ -829,6 +829,8 @@ func findPackagePath(path string, packagePathMap map[string]string) string { // package, with a "C" prefix. For example: "C compiler-rt" for the // compiler runtime library from LLVM. packagePath = "C " + strings.Split(strings.TrimPrefix(path, filepath.Join(goenv.Get("TINYGOROOT"), "lib")), string(os.PathSeparator))[1] + } else if strings.HasPrefix(path, filepath.Join(goenv.Get("TINYGOROOT"), "llvm-project")) { + packagePath = "C compiler-rt" } else if packageSymbolRegexp.MatchString(path) { // Parse symbol names like main$alloc or runtime$string. packagePath = path[:strings.LastIndex(path, "$")]