summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <pbarker@toganlabs.com>2017-10-13 19:25:28 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-16 23:52:44 +0100
commit68e77cfb8ac40926eb09f982cc835a0378ad029a (patch)
treed9c317133afd3597be2b686f7a3fbfd2b8a0370b
parentdf645a936ab374c51ef172531ca27b5b66ef3bf2 (diff)
downloadpoky-68e77cfb8ac40926eb09f982cc835a0378ad029a.tar.gz
goarch.bbclass: Define HOST_GO386 and TARGET_GO386
These variables are used to control the floating-point instructions emitted by the go compiler for x86 architectures. The default is '387' which disables the use of sse/sse2 instructions and is safe to use on all x86 processors from the i486 onwards. If TUNE_FEATURES contains a feature set which is known to support sse/sse2 instructions then they are set to 'sse2' to enable the use of these instructions. This is suitable for most processors from Pentium 4 onwards. Only the 'core2' and 'corei7' TUNE_FEATURES are defined in the oe-core layer and are known to support ss2 instructions. Other layers may introduce additional tunings which support sse2 instructions and for these layers, TARGET_GO386 or go_map_386 should be overridden as needed. (From OE-Core rev: 7e96cf3c9850dc34d53af73a9ac22b1624994484) Signed-off-by: Paul Barker <pbarker@toganlabs.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/goarch.bbclass11
1 files changed, 11 insertions, 0 deletions
diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
index 659b26a09e..653f035739 100644
--- a/meta/classes/goarch.bbclass
+++ b/meta/classes/goarch.bbclass
@@ -4,10 +4,12 @@ BUILD_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('TUNE_FEATURES'), d)}"
7HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
7HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}" 8HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
8TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}" 9TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
9TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}" 10TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
10TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" 11TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
12TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
11TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}" 13TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
12GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}" 14GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}"
13 15
@@ -66,6 +68,15 @@ def go_map_arm(a, f, d):
66 return '5' 68 return '5'
67 return '' 69 return ''
68 70
71def go_map_386(a, f, d):
72 import re
73 if re.match('i.86', a):
74 if ('core2' in f) or ('corei7' in f):
75 return 'sse2'
76 else:
77 return '387'
78 return ''
79
69def go_map_os(o, d): 80def go_map_os(o, d):
70 if o.startswith('linux'): 81 if o.startswith('linux'):
71 return 'linux' 82 return 'linux'