Skip to content
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: missing section for relocation target #30768

Closed
csqshz opened this issue Mar 12, 2019 · 11 comments
Closed

cmd/link: missing section for relocation target #30768

csqshz opened this issue Mar 12, 2019 · 11 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@csqshz
Copy link

csqshz commented Mar 12, 2019

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.

  1. ~$: git clone git://git.yoctoproject.org/poky
  2. ~$: cd poky/
  3. ~/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
  4. ~/poky: source ../oe-init-build-env
  5. ~/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
    "
  6. 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.

@ianlancetaylor
Copy link
Contributor

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.

@ianlancetaylor ianlancetaylor changed the title I met some Error: type..eUfRrckI: missing section for relocation target type..FEeY9FdU cmd/link: missing section for relocation target Mar 12, 2019
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 12, 2019
@ianlancetaylor ianlancetaylor added this to the Go1.13 milestone Mar 12, 2019
@csqshz
Copy link
Author

csqshz commented Mar 13, 2019

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.

@ianlancetaylor ianlancetaylor removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 13, 2019
@csqshz
Copy link
Author

csqshz commented Mar 18, 2019

I found the following commit introduced the issue.
Golang: 685aca4
https://github.com/golang/go/commit/685aca45dc8435df7b7e8059a42a8a98efdaf22c

@yunabe
Copy link

yunabe commented Mar 29, 2019

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)

@stevegt
Copy link

stevegt commented Jul 10, 2019

@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.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.14, Go1.13 Jul 10, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/185539 mentions this issue: cmd/link: resolve aliases when renaming a symbol

@ianlancetaylor
Copy link
Contributor

@gopherbot please open backport to 1.12

@gopherbot
Copy link
Contributor

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.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/186077 mentions this issue: cmd/link: put shlib ".type" functions in internal ABI

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/186183 mentions this issue: [release-branch.go1.12] cmd/link: put shlib ".type" functions in internal ABI

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/186278 mentions this issue: [release-branch.go1.12] cmd/link: put shlib ".type" functions in internal ABI

gopherbot pushed a commit that referenced this issue Jul 16, 2019
…rnal ABI

These functions are compiler generated, and as such are only available
in the internal ABI. Doing this avoids generating an alias symbol.
Doing that avoids confusion between unmangled and mangled type symbols.

Updates #30768
Fixes #33040

Change-Id: I8aba3934ffa994b1a19fc442cfe3e05642792a25
Reviewed-on: https://go-review.googlesource.com/c/go/+/186278
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
@golang golang locked and limited conversation to collaborators Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

6 participants