Skip to content

Commit 59cebf2

Browse files
nalindrhatdan
authored andcommitted
Use -z,muldefs on arm,x86
Pull in changes from upstream PR#18197: 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 addd5a9 commit 59cebf2

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
@@ -19,6 +19,22 @@ if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARC
1919
esac
2020
fi
2121

22+
if [ "$(go env GOOS)" == "linux" ] ; then
23+
case "$(go env GOARCH)" in
24+
arm*|386)
25+
# linking for Linux on arm or x86 needs external linking to avoid
26+
# https://github.com/golang/go/issues/9510 until we move to Go 1.6
27+
if [ "$IAMSTATIC" == "true" ] ; then
28+
export EXTLDFLAGS_STATIC="$EXTLDFLAGS_STATIC -zmuldefs"
29+
export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC -extldflags \"$EXTLDFLAGS_STATIC\""
30+
31+
else
32+
export LDFLAGS="$LDFLAGS -extldflags -zmuldefs"
33+
fi
34+
;;
35+
esac
36+
fi
37+
2238
echo "Building: $DEST/$BINARY_FULLNAME"
2339
go build \
2440
-o "$DEST/$BINARY_FULLNAME" \

0 commit comments

Comments
 (0)