diff options
author | Mark Asselstine <mark.asselstine@windriver.com> | 2019-03-18 11:21:53 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-10 13:46:17 +0100 |
commit | a126d2383391d065c020253be03e53475659fccf (patch) | |
tree | a8ff724df2c99bea8aa38f72768f579ac7db7385 | |
parent | bb04858ea65a4808c3164c77b69855bb8ebc4075 (diff) | |
download | poky-a126d2383391d065c020253be03e53475659fccf.tar.gz |
goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm()
Per https://github.com/golang/go/wiki/GoArm we need to set GOARM when
cross building for ARMv5, ARMv6 and ARMv7. The current approach of
using TUNE_FEATURES can be error prone, as we can see today when
attempting to build for Cortex-A7 which results in GOARM=''.
Since the value of MACHINEOVERRIDES already consolidates the values of
TUNE_FEATURES into something more consistent we can use the overrides
mechanism to set GOARM, leaving just a little bit of logic in
go_map_arm() to trigger off the arch (basically target vs host)
for the setting of GOARM.
(From OE-Core rev: 5f48939e26402b77fc3343f326765137f9570f40)
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/goarch.bbclass | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass index 7aaf26aed1..909646b8d4 100644 --- a/meta/classes/goarch.bbclass +++ b/meta/classes/goarch.bbclass | |||
@@ -3,18 +3,26 @@ BUILD_GOARCH = "${@go_map_arch(d.getVar('BUILD_ARCH'), d)}" | |||
3 | BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}" | 3 | BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}" |
4 | HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}" | 4 | HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}" |
5 | HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}" | 5 | HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}" |
6 | HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 6 | HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('BASE_GOARM'), d)}" |
7 | HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 7 | HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" |
8 | HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 8 | HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" |
9 | HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" | 9 | HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" |
10 | TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}" | 10 | TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}" |
11 | TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}" | 11 | TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}" |
12 | TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 12 | TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('BASE_GOARM'), d)}" |
13 | TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 13 | TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" |
14 | TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" | 14 | TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" |
15 | TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" | 15 | TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" |
16 | GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}" | 16 | GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}" |
17 | 17 | ||
18 | # Use the MACHINEOVERRIDES to map ARM CPU architecture passed to GO via GOARM. | ||
19 | # This is combined with *_ARCH to set HOST_GOARM and TARGET_GOARM. | ||
20 | BASE_GOARM = '' | ||
21 | BASE_GOARM_armv7ve = '7' | ||
22 | BASE_GOARM_armv7a = '7' | ||
23 | BASE_GOARM_armv6 = '6' | ||
24 | BASE_GOARM_armv5 = '5' | ||
25 | |||
18 | # Go supports dynamic linking on a limited set of architectures. | 26 | # Go supports dynamic linking on a limited set of architectures. |
19 | # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go | 27 | # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go |
20 | GO_DYNLINK = "" | 28 | GO_DYNLINK = "" |
@@ -76,12 +84,7 @@ def go_map_arch(a, d): | |||
76 | def go_map_arm(a, f, d): | 84 | def go_map_arm(a, f, d): |
77 | import re | 85 | import re |
78 | if re.match('arm.*', a): | 86 | if re.match('arm.*', a): |
79 | if 'armv7' in f: | 87 | return f |
80 | return '7' | ||
81 | elif 'armv6' in f: | ||
82 | return '6' | ||
83 | elif 'armv5' in f: | ||
84 | return '5' | ||
85 | return '' | 88 | return '' |
86 | 89 | ||
87 | def go_map_386(a, f, d): | 90 | def go_map_386(a, f, d): |