[dev.link] cmd/link: record external symbol alignment

Add a mechanism for recording symbol alignment for external symbols
under the new loader scheme. Alignments is stored in a side table,
since most symbols don't wind up needing an alignment other than zero.

Change-Id: I97092481412c15eac9b9f4c29b5c273f53759562
Reviewed-on: https://go-review.googlesource.com/c/go/+/210177
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2019-12-11 14:24:19 -05:00
parent 3c3ba97ba5
commit 24f9b9c8f3
2 changed files with 49 additions and 0 deletions

View file

@ -109,6 +109,17 @@ func TestAddMaterializedSymbol(t *testing.T) {
t.Errorf("ldr.SetValue(%d,%d): expected %d got %d\n", s, nv, nv, v)
}
}
// Check/set alignment
es3al := ldr.SymAlign(es3)
if es3al != 0 {
t.Errorf("SymAlign(es3): expected 0, got %d", es3al)
}
ldr.SetSymAlign(es3, 128)
es3al = ldr.SymAlign(es3)
if es3al != 128 {
t.Errorf("SymAlign(es3): expected 128, got %d", es3al)
}
}
func TestOuterSub(t *testing.T) {