Skip to content

Commit 8005057

Browse files
committed
Use -z,muldefs on arm,x86
Assume that the linker can make sense of us passing in the -z,muldefs option to tell it to ignore symbol-multiply-defined errors triggered by golang/go#9510. We should be able to stop doing this once we move to Go 1.6. Signed-off-by: Nalin Dahyabhai <[email protected]> (github: nalind)
1 parent 0ca6d77 commit 8005057

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

hack/make/binary

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ if [ "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" == "windows/amd64" ] && [ "$(go e
2525
export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC_DOCKER -linkmode=internal"
2626
fi
2727

28+
if [ "$(go env GOOS)" == "linux" ] ; then
29+
case "$(go env GOARCH)" in
30+
arm*|386)
31+
# linking for Linux on arm or x86 needs external linking to avoid
32+
# https://github.com/golang/go/issues/9510 until we move to Go 1.6
33+
if [ "$IAMSTATIC" == "true" ] ; then
34+
export EXTLDFLAGS_STATIC="$EXTLDFLAGS_STATIC -zmuldefs"
35+
export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC -extldflags \"$EXTLDFLAGS_STATIC\""
36+
37+
else
38+
export LDFLAGS="$LDFLAGS -extldflags -zmuldefs"
39+
fi
40+
;;
41+
esac
42+
fi
43+
2844
if [ "$IAMSTATIC" == "true" ] && [ "$(go env GOHOSTOS)" == "linux" ] && [ "$DOCKER_EXPERIMENTAL" ]; then
2945
if [ "${GOOS}/${GOARCH}" == "darwin/amd64" ]; then
3046
export CGO_ENABLED=1

0 commit comments

Comments
 (0)