Skip to content

Commit ead310c

Browse files
crazy-maxthaJeztah
authored andcommitted
hack: name for target ARM architecture not specified
Build currently doesn't set the right name for target ARM architecture through switches in CGO_CFLAGS and CGO_CXXFLAGS when doing cross-compilation. This was previously fixed in moby#43474 Also removes the toolchain configuration. Following changes for cross-compilation in moby#44546, we forgot to remove the toolchain configuration that is not used anymore as xx already sets correct cc/cxx envs already. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> (cherry picked from commit 9457042) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 41b61c6 commit ead310c

1 file changed

Lines changed: 16 additions & 53 deletions

File tree

hack/make/.binary

Lines changed: 16 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,22 @@ source "${MAKEDIR}/.go-autogen"
1616
(
1717
export GOGC=${DOCKER_BUILD_GOGC:-1000}
1818

19-
# for non-sandboxed invocation
20-
if ! command -v xx-go > /dev/null 2>&1; then
21-
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
22-
# must be cross-compiling!
23-
case "$(go env GOOS)/$(go env GOARCH)" in
24-
windows/amd64)
25-
export CC="${CC:-x86_64-w64-mingw32-gcc}"
26-
export CGO_ENABLED=1
27-
;;
28-
linux/arm)
29-
case "${GOARM}" in
30-
5)
31-
export CC="${CC:-arm-linux-gnueabi-gcc}"
32-
export CGO_ENABLED=1
33-
export CGO_CFLAGS="-march=armv5t"
34-
export CGO_CXXFLAGS="-march=armv5t"
35-
;;
36-
6)
37-
export CC="${CC:-arm-linux-gnueabi-gcc}"
38-
export CGO_ENABLED=1
39-
export CGO_CFLAGS="-march=armv6"
40-
export CGO_CXXFLAGS="-march=armv6"
41-
;;
42-
7)
43-
export CC="${CC:-arm-linux-gnueabihf-gcc}"
44-
export CGO_ENABLED=1
45-
export CGO_CFLAGS="-march=armv7-a"
46-
export CGO_CXXFLAGS="-march=armv7-a"
47-
;;
48-
*)
49-
export CC="${CC:-arm-linux-gnueabihf-gcc}"
50-
export CGO_ENABLED=1
51-
;;
52-
esac
53-
;;
54-
linux/arm64)
55-
export CC="${CC:-aarch64-linux-gnu-gcc}"
56-
export CGO_ENABLED=1
57-
;;
58-
linux/amd64)
59-
export CC="${CC:-x86_64-linux-gnu-gcc}"
60-
export CGO_ENABLED=1
61-
;;
62-
linux/ppc64le)
63-
export CC="${CC:-powerpc64le-linux-gnu-gcc}"
64-
export CGO_ENABLED=1
65-
;;
66-
linux/s390x)
67-
export CC="${CC:-s390x-linux-gnu-gcc}"
68-
export CGO_ENABLED=1
69-
;;
70-
esac
71-
fi
19+
if [ "$(go env GOOS)/$(go env GOARCH)" = "linux/arm" ]; then
20+
# specify name of the target ARM architecture
21+
case "$(go env GOARM)" in
22+
5)
23+
export CGO_CFLAGS="-march=armv5t"
24+
export CGO_CXXFLAGS="-march=armv5t"
25+
;;
26+
6)
27+
export CGO_CFLAGS="-march=armv6"
28+
export CGO_CXXFLAGS="-march=armv6"
29+
;;
30+
7)
31+
export CGO_CFLAGS="-march=armv7-a"
32+
export CGO_CXXFLAGS="-march=armv7-a"
33+
;;
34+
esac
7235
fi
7336

7437
# -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be

0 commit comments

Comments
 (0)