cmd/link: missing section for relocation target
csqshz opened this issue · 11 comments
What version of Go are you using (go version
)?
$ go version go version go1.12 linux/amd64
What operating system and processor architecture are you using (go env
)?
My host is ubuntu 1404.
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/folk/hsong/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/build" GOPROXY="" GORACE="" GOROOT="/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot/usr/lib/go" GOTMPDIR="/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/go-tmp" GOTOOLDIR="/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot-native/usr/lib/x86_64-poky-linux/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="x86_64-poky-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot" CXX="x86_64-poky-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0=/usr/src/debug/consul/git-r0 -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0=/usr/src/debug/consul/git-r0 -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot= -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot-native=" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0=/usr/src/debug/consul/git-r0 -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0=/usr/src/debug/consul/git-r0 -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot= -fdebug-prefix-map=/ala-lpggp22/hsong/poky/build/tmp/work/core2-64-poky-linux/consul/git-r0/recipe-sysroot-native= -fvisibility-inlines-hidden" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now" PKG_CONFIG="pkg-config"
What did you do?
I use Yocto-project to build consul.
It works with go-1.11 but compile failed with go-1.12.
I found that If I remove -linkshared argument, it also works with go-1.12
The error info is as following:
# github.com/hashicorp/consul/connect/certgen
type..eUfRrckI: missing section for relocation target type..FEeY9FdU
type..eUfRrckI: reloc 8 (R_CALL) to non-elf symbol type..FEeY9FdU (outer=type..FEeY9FdU) 49 (SABIALIAS)
# github.com/hashicorp/consul
type..eUfRrckI: missing section for relocation target type..FEeY9FdU
type..K6Uq9NPs: missing section for relocation target type..tBBUxeDj
The above prompts are from /usr/lib/go-1.12/src/cmd/link/internal/ld/data.go
Attachment is my bash script which contains go install command.
It failed at line:130(-linkshared):
run.do_compile.txt
Could someone give me some direction to fix or locate the issue? Maybe the issue is related with my environment.
Thanks.
How to reproduce.
We should build a Yocto Project.
- ~$: git clone git://git.yoctoproject.org/poky
- ~$: cd poky/
- ~/poky: git clone git://git.yoctoproject.org/meta-cloud-services
~/poky: git clone git://git.yoctoproject.org/meta-virtualization
~/poky: git clone git://git.openembedded.org/meta-openembedded - ~/poky: source ../oe-init-build-env
- ~/poky/build: vi conf/bblayers.conf
Add six paths to BBLAYERS:
BBLAYERS ?= " \
/ala-lpggp22/hsong/poky-qcon/meta
/ala-lpggp22/hsong/poky-qcon/meta-poky
/ala-lpggp22/hsong/poky-qcon/meta-yocto-bsp
/ala-lpggp22/hsong/poky-qcon/meta-virtualization
/ala-lpggp22/hsong/poky-qcon/meta-cloud-services
/ala-lpggp22/hsong/poky-qcon/meta-openembedded/meta-python
/ala-lpggp22/hsong/poky-qcon/meta-openembedded/meta-networking
/ala-lpggp22/hsong/poky-qcon/meta-openembedded/meta-filesystems
/ala-lpggp22/hsong/poky-qcon/meta-openembedded/meta-oe
" - bitbake consul
This command will build consul and its dependencies.
Then the issue will prompt when doing do_compile of consul.
If you have any question about Yocto Project with please contact me.
Please cut and paste text. Please do not post screenshots, as they are read and harder to work with. Thanks.
Can you tell us exactly how to recreate the problem? Thanks.
Please cut and paste text. Please do not post screenshots, as they are read and harder to work with. Thanks.
Can you tell us exactly how to recreate the problem? Thanks.
Thanks for your reply. I have remedied my content that adding attachment and appending how to reproduce the issue.
I found the following commit introduced the issue.
Golang: 685aca4
https://github.com/golang/go/commit/685aca45dc8435df7b7e8059a42a8a98efdaf22c
I encountered this issue when I debugged yunabe/lgo#82.
I created a minimal example to reproduce this issue with go1.12.1.
https://github.com/yunabe/gobug30768
How to reproduce the issue
go get -d github.com/yunabe/gobug30768
(cd /tmp && rm pkg -rf && go install -buildmode=shared -linkshared -pkgdir pkg std && go build -linkshared -pkgdir pkg github.com/yunabe/gobug30768 && ldd gobug30768)
Expected
go build
outputs a binary and ldd
shows information like:
...
libstd.so => /tmp/pkg/libstd.so
...
Actual
go build
fails with the following error message:
# github.com/yunabe/gobug30768
type..Fm7EsLz5: missing section for relocation target type..FEeY9FdU
type..Fm7EsLz5: reloc 8 (R_CALL) to non-elf symbol type..FEeY9FdU (outer=type..FEeY9FdU) 49 (SABIALIAS)
@andybons This appears to be a regression -- see https://github.com/yunabe/lgo#disclaimer. Would it make sense to add a 'Soon' label? (Looking at it, that label says it's the one for regressions.)
I'm one of the people hitting this bug -- Jupyter Notebook is stuck on Go 1.9 or so due to multiple regressions including this one. Jupyter's not a huge user base, but it does seem to exercise things pretty well.
Change https://golang.org/cl/185539 mentions this issue: cmd/link: resolve aliases when renaming a symbol
@gopherbot please open backport to 1.12
Backport issue(s) opened: #33040 (for 1.12).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.
Change https://golang.org/cl/186077 mentions this issue: cmd/link: put shlib ".type" functions in internal ABI
Change https://golang.org/cl/186183 mentions this issue: [release-branch.go1.12] cmd/link: put shlib ".type" functions in internal ABI
Change https://golang.org/cl/186278 mentions this issue: [release-branch.go1.12] cmd/link: put shlib ".type" functions in internal ABI