Skip to content

cmd/dist: misc/cgo/test: incorrect pie options used for ppc64x #21954

Closed
@laboger

Description

@laboger

What version of Go are you using (go version)?
go version go1.9 linux/ppc64le and go upstream

Does this issue reproduce with the latest release?
Yes, but the failures only happen on Unbuntu 16.04 and no other distro we've tried.

What operating system and processor architecture are you using (go env)?
Failures have only been seen on Ubuntu 16.04.
ppc64le

When building golang with ./all.bash, failures occur in some tests in misc/cgo/test with errors like this:
error while loading shared libraries: R_PPC64_ADDR16_HA re136cd776c for symbol `' out of range

After digging through cmd/dist/test.go I found that the failures occurred only when the tests were built with the external linker when passing -pie as a flag to the external linker. For example in misc/cgo/nocgo I can build the test by hand:
go test -ldflags '-linkmode=external "-extldflags=-pie"' -c
./nocgo.test
./nocgo.test: error while loading shared libraries: R_PPC64_ADDR16_HA re136cd776c for symbol `' out of range

According to the linker documentation -pie should only be used with position independent code, but for ppc64x, it is not PIC by default. Either these tests should not be built and run on ppc64x with these options, or different options should be used. It seems like -buildmode=pie is what should be used here because that will build PIC but I tried that and that resulted in different build errors which I haven't investigated yet.

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