New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: run test in -linkshared mode failed #26582

Open
wu-heng opened this Issue Jul 25, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@wu-heng

wu-heng commented Jul 25, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Linux jim-PC 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jim/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jim/go"
GORACE=""
GOROOT="/home/jim/golang/go"
GOTMPDIR=""
GOTOOLDIR="/home/jim/golang/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build891088383=/tmp/go-build -gno-record-gcc-switches"

What did you do?

1、 go install -buildmode=shared std
2、 go test -short -linkshared expvar

What did you expect to see?

expvar test PASS

What did you see instead?

failure details:
expvar (testmain)
main.statictmp_0: relocation target expvar.TestNil·f not defined
main.statictmp_0: relocation target expvar.TestInt·f not defined
main.statictmp_0: relocation target expvar.TestFloat·f not defined
main.statictmp_0: relocation target expvar.TestString·f not defined
main.statictmp_0: relocation target expvar.TestMapInit·f not defined
main.statictmp_0: relocation target expvar.TestMapCounter·f not defined
main.statictmp_0: relocation target expvar.TestFunc·f not defined
main.statictmp_0: relocation target expvar.TestHandler·f not defined
main.statictmp_1: relocation target expvar.BenchmarkIntAdd·f not defined
main.statictmp_1: relocation target expvar.BenchmarkIntSet·f not defined
main.statictmp_1: relocation target expvar.BenchmarkFloatAdd·f not defined
main.statictmp_1: relocation target expvar.BenchmarkFloatSet·f not defined
main.statictmp_1: relocation target expvar.BenchmarkStringSet·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapSet·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapSetDifferent·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapSetString·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapAddSame·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapAddDifferent·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapAddSameSteadyState·f not defined
main.statictmp_1: relocation target expvar.BenchmarkMapAddDifferentSteadyState·f not defined
main.statictmp_1: relocation target expvar.BenchmarkRealworldExpvarUsage·f not defined
/home/jim/golang/go/pkg/tool/linux_amd64/link: too many errors
FAIL expvar [build failed]

@wu-heng

This comment has been minimized.

wu-heng commented Jul 25, 2018

Bug reason: The Shlib record of the pkg "expvar" should be cleaned once the expvar pkg being rebuilt. Otherwise, the "packageshlib" key word in importcfg.link file will render the "packagefile" ineffective, in which the "packagefile" indicate the path of _pkg_.a( or cached _pkg_.a) and the "packageshlib" indicate the path of it's shlib( antiquated path: pkg/linux_amd64_dynlink/libstd.so ).

@gopherbot gopherbot referenced a pull request that will close this issue Jul 25, 2018

Open

cmd/link: clear up the Shlib record when building a pkg #26540

@andybons

This comment has been minimized.

Member

andybons commented Jul 25, 2018

@andybons andybons added this to the Unplanned milestone Jul 25, 2018

@gopherbot

This comment has been minimized.

gopherbot commented Jul 26, 2018

Change https://golang.org/cl/125441 mentions this issue: cmd/link: clear up the Shlib record when building a pkg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment