]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/compile: pass index through when re-exporting
authorCherry Zhang <cherryyz@google.com>
Thu, 17 Oct 2019 05:11:23 +0000 (01:11 -0400)
committerCherry Zhang <cherryyz@google.com>
Thu, 17 Oct 2019 20:28:15 +0000 (20:28 +0000)
commit286d744246a84b3a19093db6e7f24a823aac50bb
tree32c76d2f91b07a89066591baa184fc6c2bb3ddbc
parentb661547d94b89f6279710e4f4c58282b664e7b9c
[dev.link] cmd/compile: pass index through when re-exporting

When we re-export an imported symbol that has an index, we should
pass the index through. Currently, if the symbol is not
referenced in the generated machine code, it does not get
assigned a package index, and the exporter will not export its
symbol index. Let the exporter handle this case -- if the symbol
has a symbol index but not a package index, still export its
symbol index. This is safe as referenced-by-name symbols always
have their package indices set to a special value.

This should reduce the number of referenced-by-name symbols, and
also make the export data more stable, less dependent on codegen
details.

Change-Id: Ic515a002ae84226e7fdbe68a53496c051b7badcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/201719
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/gc/iexport.go