Browse code

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
https://github.com/golang/go/issues/9510. We should be able to stop
doing this once we move to Go 1.6.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com> (github: nalind)

Nalin Dahyabhai authored on 2015/11/25 05:19:16
Showing 1 changed files
... ...
@@ -25,6 +25,22 @@ if [ "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" == "windows/amd64" ] && [ "$(go e
25 25
 	export LDFLAGS_STATIC_DOCKER="$LDFLAGS_STATIC_DOCKER -linkmode=internal"
26 26
 fi
27 27
 
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
+
28 44
 if [ "$IAMSTATIC" == "true" ] && [ "$(go env GOHOSTOS)" == "linux" ] && [ "$DOCKER_EXPERIMENTAL" ]; then
29 45
 	if  [ "${GOOS}/${GOARCH}" == "darwin/amd64" ]; then
30 46
 		export CGO_ENABLED=1