aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader/loader.go
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2023-05-04 17:09:49 -0400
committerCherry Mui <cherryyz@google.com>2023-05-05 19:20:01 +0000
commitf90bb8a38f2f1ed2109f8fa88fb90a5c2db1f3fe (patch)
treecece8ec0b7f198ee24034f36848dee831a131211 /src/cmd/link/internal/loader/loader.go
parent26899ef3ee7cd3d9e663e6f792c93bb411c863db (diff)
downloadgo-f90bb8a38f2f1ed2109f8fa88fb90a5c2db1f3fe.tar.xz
cmd/link: remove elfsetstring out of the loader
Currently, we pass elfsetstring to the loader as a callback, for a special case of Addstring. This is only used for ELF when adding strings to the section header string table. Move the logic to the caller instead, so the loader would not have this special case. Change-Id: Icfb91f380fe4ba435985c3019681597932f58242 Reviewed-on: https://go-review.googlesource.com/c/go/+/492718 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link/internal/loader/loader.go')
-rw-r--r--src/cmd/link/internal/loader/loader.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index fa74dcede4..f4b075b077 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -261,8 +261,6 @@ type Loader struct {
strictDupMsgs int // number of strict-dup warning/errors, when FlagStrictDups is enabled
- elfsetstring elfsetstringFunc
-
errorReporter *ErrorReporter
npkgsyms int // number of package symbols, for accounting
@@ -284,8 +282,6 @@ const (
goObjStart
)
-type elfsetstringFunc func(str string, off int)
-
// extSymPayload holds the payload (data + relocations) for linker-synthesized
// external symbols (note that symbol value is stored in a separate slice).
type extSymPayload struct {
@@ -304,7 +300,7 @@ const (
FlagStrictDups = 1 << iota
)
-func NewLoader(flags uint32, elfsetstring elfsetstringFunc, reporter *ErrorReporter) *Loader {
+func NewLoader(flags uint32, reporter *ErrorReporter) *Loader {
nbuiltin := goobj.NBuiltin()
extReader := &oReader{objidx: extObj}
ldr := &Loader{
@@ -333,7 +329,6 @@ func NewLoader(flags uint32, elfsetstring elfsetstringFunc, reporter *ErrorRepor
extStaticSyms: make(map[nameVer]Sym),
builtinSyms: make([]Sym, nbuiltin),
flags: flags,
- elfsetstring: elfsetstring,
errorReporter: reporter,
sects: []*sym.Section{nil}, // reserve index 0 for nil section
}