From: Than McIntosh Date: Wed, 17 Jun 2020 14:41:56 +0000 (-0400) Subject: [dev.link] cmd/internal/obj: don't write builtin names in obj writer X-Git-Tag: go1.16beta1~1378^2~76 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=be38746eb49a479118c8e7833c106687a28676e2;p=gostls13.git [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 --- diff --git a/src/cmd/internal/obj/objfile2.go b/src/cmd/internal/obj/objfile2.go index 898f0a113a..b12b6fe84c 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) {