summaryrefslogtreecommitdiffstats
path: root/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch')
-rw-r--r--recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch104
1 files changed, 95 insertions, 9 deletions
diff --git a/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
index c10e69d3..ea8f4c5e 100644
--- a/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
+++ b/recipes-containers/docker/files/0001-dynbinary-use-go-cross-compiler.patch
@@ -1,20 +1,106 @@
1From bbf600cc4d46c3f7ec0c1b486790a2402d41f550 Mon Sep 17 00:00:00 2001 1From 3ce6089417b8c6c4e8279e6ef60213436ebf8793 Mon Sep 17 00:00:00 2001
2From: Bruce Ashfield <bruce.ashfield@gmail.com> 2From: Bruce Ashfield <bruce.ashfield@gmail.com>
3Date: Tue, 30 Jun 2020 22:23:33 -0400 3Date: Tue, 30 Jun 2020 22:23:33 -0400
4Subject: [PATCH] dynbinary: use go cross compiler 4Subject: [PATCH] dynbinary: use go cross compiler
5 5
6MJ: use ${GO} also in "go env" calls, because native go:
7 $ go env GOARM
8 5
9while go cross compiler for my target:
10 $ ${GO} env GOARM
11 7
12this can lead to:
13 error: switch '-mcpu=cortex-a9' conflicts with switch '-march=armv5t' [-Werror]
14
15but even after fixing it to use "better" -march it still doesn't match with -mcpu
16set in our GOBUILDFLAGS, causing e.g.:
17 error: switch '-mcpu=cortex-a9' conflicts with switch '-march=armv7-a+simd' [-Werror]
18
19so drop CGO_CFLAGS/CGO_CXXFLAGS as in OE builds we don't need them
20as long as ${GO} and GOBUILDFLAGS are respected
21
22it was added in:
23https://github.com/moby/moby/commit/12558c8d6ea9f388b54eb94ba6b9eb4a9fc5c9f2
24
25and it wasn't an issue before:
26https://github.com/moby/moby/commit/8c12a6648b368cc2acaea0339d6c57c920ed265c
27
28because it was using 'case "${GOARM}" in' and ${GOARM} was empty in our builds
29
6Upstream-Status: Inappropriate [embedded specific] 30Upstream-Status: Inappropriate [embedded specific]
7 31
32Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
8Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> 33Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
9--- 34---
10 hack/make/.binary | 2 +- 35 hack/make/.binary | 37 ++++++++-----------------------------
11 1 file changed, 1 insertion(+), 1 deletion(-) 36 1 file changed, 8 insertions(+), 29 deletions(-)
12 37
13Index: git/src/import/hack/make/.binary 38diff --git a/hack/make/.binary b/hack/make/.binary
14=================================================================== 39index 39c00cd50c..de32ad1cc7 100644
15--- git.orig/src/import/hack/make/.binary 40--- a/hack/make/.binary
16+++ git/src/import/hack/make/.binary 41+++ b/hack/make/.binary
17@@ -66,7 +66,7 @@ 42@@ -3,7 +3,7 @@ set -e
43
44 # a helper to provide ".exe" when it's appropriate
45 binary_extension() {
46- if [ "$(go env GOOS)" = 'windows' ]; then
47+ if [ "$(${GO} env GOOS)" = 'windows' ]; then
48 echo -n '.exe'
49 fi
50 }
51@@ -16,33 +16,12 @@ source "${MAKEDIR}/.go-autogen"
52 (
53 export GOGC=${DOCKER_BUILD_GOGC:-1000}
54
55- if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
56- # must be cross-compiling!
57- if [ "$(go env GOOS)/$(go env GOARCH)" = "linux/arm" ]; then
58- # specify name of the target ARM architecture
59- case "$(go env GOARM)" in
60- 5)
61- export CGO_CFLAGS="-march=armv5t"
62- export CGO_CXXFLAGS="-march=armv5t"
63- ;;
64- 6)
65- export CGO_CFLAGS="-march=armv6"
66- export CGO_CXXFLAGS="-march=armv6"
67- ;;
68- 7)
69- export CGO_CFLAGS="-march=armv7-a"
70- export CGO_CXXFLAGS="-march=armv7-a"
71- ;;
72- esac
73- fi
74- fi
75-
76 # -buildmode=pie is not supported on Windows arm64 and Linux mips*, ppc64be
77 # https://github.com/golang/go/blob/go1.19.4/src/cmd/internal/sys/supported.go#L125-L132
78 if ! [ "$DOCKER_STATIC" = "1" ]; then
79 # -buildmode=pie not supported when -race is enabled
80 if [[ " $BUILDFLAGS " != *" -race "* ]]; then
81- case "$(go env GOOS)/$(go env GOARCH)" in
82+ case "$(${GO} env GOOS)/$(${GO} env GOARCH)" in
83 windows/arm64 | linux/mips* | linux/ppc64) ;;
84 *)
85 BUILDFLAGS+=("-buildmode=pie")
86@@ -54,11 +33,11 @@ source "${MAKEDIR}/.go-autogen"
87 # only necessary for non-sandboxed invocation where TARGETPLATFORM is empty
88 PLATFORM_NAME=$TARGETPLATFORM
89 if [ -z "$PLATFORM_NAME" ]; then
90- PLATFORM_NAME="$(go env GOOS)/$(go env GOARCH)"
91- if [ -n "$(go env GOARM)" ]; then
92- PLATFORM_NAME+="/v$(go env GOARM)"
93- elif [ -n "$(go env GOAMD64)" ] && [ "$(go env GOAMD64)" != "v1" ]; then
94- PLATFORM_NAME+="/$(go env GOAMD64)"
95+ PLATFORM_NAME="$(${GO} env GOOS)/$(${GO} env GOARCH)"
96+ if [ -n "$(${GO} env GOARM)" ]; then
97+ PLATFORM_NAME+="/v$(${GO} env GOARM)"
98+ elif [ -n "$(${GO} env GOAMD64)" ] && [ "$(${GO} env GOAMD64)" != "v1" ]; then
99+ PLATFORM_NAME+="/$(${GO} env GOAMD64)"
100 fi
101 fi
102
103@@ -66,7 +45,7 @@ source "${MAKEDIR}/.go-autogen"
18 if [ -n "$DOCKER_DEBUG" ]; then 104 if [ -n "$DOCKER_DEBUG" ]; then
19 set -x 105 set -x
20 fi 106 fi