From be38746eb49a479118c8e7833c106687a28676e2 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Wed, 17 Jun 2020 10:41:56 -0400 Subject: [PATCH] [dev.link] cmd/internal/obj: don't write builtin names in obj writer Change the object file writer to avoid adding entries to the object file string table for builtin functions. This helps save some very small amount of space in the object file. Change-Id: Ic3b94a154e00eb4c7378b57613580c7073b841bc Reviewed-on: https://go-review.googlesource.com/c/go/+/239657 Reviewed-by: Cherry Zhang Reviewed-by: Jeremy Faller --- src/cmd/internal/obj/objfile2.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/internal/obj/objfile2.go b/src/cmd/internal/obj/objfile2.go index 898f0a113ad..b12b6fe84c4 100644 --- a/src/cmd/internal/obj/objfile2.go +++ b/src/cmd/internal/obj/objfile2.go @@ -208,6 +208,11 @@ func (w *writer) StringTable() { if w.pkgpath != "" { s.Name = strings.Replace(s.Name, "\"\".", w.pkgpath+".", -1) } + // Don't put names of builtins into the string table (to save + // space). + if s.PkgIdx == goobj2.PkgIdxBuiltin { + return + } w.AddString(s.Name) }) w.ctxt.traverseSyms(traverseDefs, func(s *LSym) {