From f90bb8a38f2f1ed2109f8fa88fb90a5c2db1f3fe Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Thu, 4 May 2023 17:09:49 -0400 Subject: 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 TryBot-Result: Gopher Robot Reviewed-by: Than McIntosh --- src/cmd/link/internal/loader/loader.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/cmd/link/internal/loader/loader.go') 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 } -- cgit v1.3-5-g9baa