Skip to content

cmd/link: missing section for relocation target #30768

Closed
@csqshz

Description

@csqshz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions