]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/internal/obj: trim trailing zeros for content hashing
authorCherry Zhang <cherryyz@google.com>
Mon, 20 Jul 2020 23:03:33 +0000 (19:03 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 30 Jul 2020 18:37:08 +0000 (18:37 +0000)
commitb3e3c339ff02ccd1cf76eb07513e4f9051a55333
treeed106d500e3191d16dcaa6a4f789f4f1028dde93
parent4a9237129198d2082f8346d162a011a341b757a6
[dev.link] cmd/internal/obj: trim trailing zeros for content hashing

The symbol's data in the object file (sym.P) may already not
contain trailing zeros (e,g, for [10]int{1}), but sometimes it
does (e.g. for [10]int{1,0}). The linker can already handle this
case. We just always trim the trailing zeros for content hashing,
so it can deduplicate [10]int{1} and [10]int{1,0}.

Note: in theory we could just trim the zeros in the symbol data
as well. But currently the linker depends on reading symbol data
for certain symbols (e.g. type symbol decoding), and trimming
will complicates things in the linker.

Change-Id: I9e90e41e6ac808b36855b0713a85e61c33bf093a
Reviewed-on: https://go-review.googlesource.com/c/go/+/245717
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/internal/obj/objfile2.go