mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] cmd/internal/obj: make integer/float constant symbols content-addressable
Fill in the data at compile time, and get rid of the preprocess function in the linker. We need to be careful with symbol alignment: data symbols are generally naturally aligned, except for string symbols which are not aligned. When deduplicating two symbols with same content but different alignments, we need to keep the biggest alignment. Change-Id: I4bd96adfdc5f704b5bf3a0e723457c9bfe16a684 Reviewed-on: https://go-review.googlesource.com/c/go/+/242081 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
17344d55d6
commit
3c54069907
5 changed files with 75 additions and 50 deletions
|
|
@ -6,6 +6,7 @@ package loader
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"cmd/internal/goobj2"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/sys"
|
||||
"cmd/link/internal/sym"
|
||||
|
|
@ -20,7 +21,7 @@ import (
|
|||
// data or relocations).
|
||||
func addDummyObjSym(t *testing.T, ldr *Loader, or *oReader, name string) Sym {
|
||||
idx := uint32(len(ldr.objSyms))
|
||||
s, ok := ldr.AddSym(name, 0, or, idx, nonPkgDef, false, sym.SRODATA)
|
||||
s, ok := ldr.addSym(name, 0, or, idx, nonPkgDef, &goobj2.Sym{})
|
||||
if !ok {
|
||||
t.Errorf("AddrSym failed for '" + name + "'")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue