From 128f4e51f2d60c984f9bcb68ac141eff6e47875e Mon Sep 17 00:00:00 2001 From: Jeremy Faller Date: Tue, 28 Jul 2020 13:49:13 -0400 Subject: [PATCH] [dev.link] ensure package path is set when TEXT symbols are created We're reworking pclntab generation in the linker, and with that we're moving FuncID generation in to the compiler. Determining the FuncID is done by a lookup on the package.function name; therefore, we need the package whenever we make the TEXT symbols. Change-Id: I805445ffbf2f895f06ce3a91fb09126d012bf86e Reviewed-on: https://go-review.googlesource.com/c/go/+/245318 Reviewed-by: Austin Clements Reviewed-by: Cherry Zhang --- src/cmd/compile/internal/gc/main.go | 3 ++- src/cmd/dist/build.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index bb28ef01a1..4417e70616 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -285,6 +285,8 @@ func Main(archInit func(*Arch)) { objabi.Flagparse(usage) + Ctxt.Pkgpath = myimportpath + for _, f := range strings.Split(spectre, ",") { f = strings.TrimSpace(f) switch f { @@ -789,7 +791,6 @@ func Main(archInit func(*Arch)) { // Write object data to disk. timings.Start("be", "dumpobj") dumpdata() - Ctxt.Pkgpath = myimportpath Ctxt.NumberSyms() dumpobj() if asmhdr != "" { diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 9e2b4f33b8..a817e6fcd7 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -824,6 +824,7 @@ func runInstall(pkg string, ch chan struct{}) { "-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch, "-D", "GOOS_GOARCH_" + goos + "_" + goarch, + "-p", pkg, } if goarch == "mips" || goarch == "mipsle" { // Define GOMIPS_value from gomips. -- 2.50.0