]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/internal/obj: don't write builtin names in obj writer
authorThan McIntosh <thanm@google.com>
Wed, 17 Jun 2020 14:41:56 +0000 (10:41 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 25 Jun 2020 11:18:58 +0000 (11:18 +0000)
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 <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/internal/obj/objfile2.go

index 898f0a113ad8cae1049a1f971e90868872800a08..b12b6fe84c46e557c3ca5cc696d44f9a878541f2 100644 (file)
@@ -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) {