aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loader/loader.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-06-02 17:45:57 -0400
committerCherry Zhang <cherryyz@google.com>2020-06-03 19:20:56 +0000
commit73dd74a9fe5a000123c0ef47ce5e0dbea1907d41 (patch)
treecf8c810d694cba9fdbab676d7d5455be45bec2fa /src/cmd/link/internal/loader/loader.go
parentb7717e46340b7ffe5fd53313f10dfa85a141f77a (diff)
downloadgo-73dd74a9fe5a000123c0ef47ce5e0dbea1907d41.tar.gz
go-73dd74a9fe5a000123c0ef47ce5e0dbea1907d41.zip
cmd/internal/goobj2: add referenced symbol names to object file
Currently, for symbols defined in other packages and referenced by index, we don't record its name in the object file, as the linker doesn't need the name, only the index. As a consequence, tools like objdump and nm also don't know the referenced symbol names and cannot dump it properly. This CL adds referenced symbol names to the object file. So the object file is self-contained. And tools can retrieve referenced symbol names properly. Tools now should work as good for new object files as for old object files. Fixes #38875. Change-Id: I16c685c1fd83273ab1faef474e19acf4af46396f Reviewed-on: https://go-review.googlesource.com/c/go/+/236168 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Jeremy Faller <jeremy@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.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index 8e6451d270..ab38bc3f5c 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -1914,7 +1914,7 @@ func (l *Loader) FuncInfo(i Sym) FuncInfo {
// Does not read symbol data.
// Returns the fingerprint of the object.
func (l *Loader) Preload(syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64) goobj2.FingerprintType {
- roObject, readonly, err := f.Slice(uint64(length))
+ roObject, readonly, err := f.Slice(uint64(length)) // TODO: no need to map blocks that are for tools only (e.g. RefName)
if err != nil {
log.Fatal("cannot read object file:", err)
}