aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-03-26 14:43:15 -0400
committerCherry Zhang <cherryyz@google.com>2020-03-27 00:06:39 +0000
commitc7e3d817ab48a6a8a0221d78a54d76bbb4e07e4b (patch)
treea3f755e27cb5c9fe236a655ceec4b87d4e61b270 /src/cmd/link/internal/loader
parentc5f692021279ee4c6426130f4525d8053fffcbcf (diff)
downloadgo-c7e3d817ab48a6a8a0221d78a54d76bbb4e07e4b.tar.xz
[dev.link] cmd/link: migrate symbol's Value and Align when converting to sym.Symbols
Currently, in LoadFull we migrate a symbol's Value to sym.Symbol only for external symbols. And symbol's Align is not migrated at all. As we move LoadFull forward, there are already places where we set symbol's Value and Align (e.g. in doelf). Migrate them correctly. Currently I think we only set them on external symbols, but as we move forward I think we'll need to set them on Go symbols as well. Change-Id: I63e97e38fc08b653ba9faefe15697944faf21bed Reviewed-on: https://go-review.googlesource.com/c/go/+/225658 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loader')
-rw-r--r--src/cmd/link/internal/loader/loader.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index 7e8469f501..e342fbe680 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -1833,11 +1833,9 @@ func (l *Loader) LoadFull(arch *sys.Arch, syms *sym.Symbols) {
s.Version = int16(pp.ver)
s.Type = pp.kind
s.Size = pp.size
- s.Value = l.SymValue(i)
if pp.gotype != 0 {
s.Gotype = l.Syms[pp.gotype]
}
- s.Value = l.values[i]
if f, ok := l.symFile[i]; ok {
s.File = f
} else if pp.objidx != 0 {
@@ -2326,6 +2324,9 @@ func (l *Loader) CopyAttributes(src Sym, dst Sym) {
// migrateAttributes copies over all of the attributes of symbol 'src' to
// sym.Symbol 'dst'.
func (l *Loader) migrateAttributes(src Sym, dst *sym.Symbol) {
+ dst.Value = l.SymValue(src)
+ dst.Align = l.SymAlign(src)
+
dst.Attr.Set(sym.AttrReachable, l.AttrReachable(src))
dst.Attr.Set(sym.AttrOnList, l.AttrOnList(src))
dst.Attr.Set(sym.AttrLocal, l.AttrLocal(src))