summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2019-03-18 11:21:53 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-10 13:46:17 +0100
commita126d2383391d065c020253be03e53475659fccf (patch)
treea8ff724df2c99bea8aa38f72768f579ac7db7385
parentbb04858ea65a4808c3164c77b69855bb8ebc4075 (diff)
downloadpoky-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.bbclass19
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)}"
3BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}" 3BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
4HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}" 4HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
5HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}" 5HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
6HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 6HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('BASE_GOARM'), d)}"
7HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 7HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
8HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 8HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
9HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" 9HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
10TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}" 10TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
11TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}" 11TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
12TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 12TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('BASE_GOARM'), d)}"
13TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 13TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
14TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 14TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
15TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" 15TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
16GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}" 16GO_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.
20BASE_GOARM = ''
21BASE_GOARM_armv7ve = '7'
22BASE_GOARM_armv7a = '7'
23BASE_GOARM_armv6 = '6'
24BASE_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
20GO_DYNLINK = "" 28GO_DYNLINK = ""
@@ -76,12 +84,7 @@ def go_map_arch(a, d):
76def go_map_arm(a, f, d): 84def 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
87def go_map_386(a, f, d): 90def go_map_386(a, f, d):