From: Martin Jansa <martin.jansa@gmail.com>
To: Mark Asselstine <mark.asselstine@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [v3][PATCH 2/2] goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm()
Date: Mon, 18 Mar 2019 17:40:28 +0100 [thread overview]
Message-ID: <20190318164028.GD1994@jama> (raw)
In-Reply-To: <1552922513-21915-2-git-send-email-mark.asselstine@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 3733 bytes --]
On Mon, Mar 18, 2019 at 11:21:53AM -0400, Mark Asselstine wrote:
> 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.
>
> Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
> ---
>
> V2
> * Cover all ARMv7 Cortex* variants
>
> V3
> * Switch to using MACHINEOVERRIDES/overrides mechanism
>
> meta/classes/goarch.bbclass | 19 +++++++++++--------
> 1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
> index 39fea5e..8fdb443 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)}"
> BUILD_GOTUPLE = "${BUILD_GOOS}_${BUILD_GOARCH}"
> HOST_GOOS = "${@go_map_os(d.getVar('HOST_OS'), d)}"
> HOST_GOARCH = "${@go_map_arch(d.getVar('HOST_ARCH'), d)}"
> -HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> +HOST_GOARM = "${@go_map_arm(d.getVar('HOST_ARCH'), d.getVar('BASE_GOARM'), d)}"
> HOST_GO386 = "${@go_map_386(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> HOST_GOMIPS = "${@go_map_mips(d.getVar('HOST_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> HOST_GOTUPLE = "${HOST_GOOS}_${HOST_GOARCH}"
> TARGET_GOOS = "${@go_map_os(d.getVar('TARGET_OS'), d)}"
> TARGET_GOARCH = "${@go_map_arch(d.getVar('TARGET_ARCH'), d)}"
> -TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> +TARGET_GOARM = "${@go_map_arm(d.getVar('TARGET_ARCH'), d.getVar('BASE_GOARM'), d)}"
> TARGET_GO386 = "${@go_map_386(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> TARGET_GOMIPS = "${@go_map_mips(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"
> TARGET_GOTUPLE = "${TARGET_GOOS}_${TARGET_GOARCH}"
> GO_BUILD_BINDIR = "${@['bin/${HOST_GOTUPLE}','bin'][d.getVar('BUILD_GOTUPLE') == d.getVar('HOST_GOTUPLE')]}"
>
> +# Use the MACHINEOVERRIDES to map ARM CPU architecture passed to GO via GOARM.
> +# This is combined with *_ARCH to set HOST_GOARM and TARGET_GOARM.
> +BASE_GOARM = ''
> +BASE_GOARM_armv7ve = '7'
> +BASE_GOARM_armv7a = '7'
> +BASE_GOARM_armv6 = '6'
> +BASE_GOARM_armv5 = '5'
> +
> # Go supports dynamic linking on a limited set of architectures.
> # See the supportsDynlink function in go/src/cmd/compile/internal/gc/main.go
> GO_DYNLINK = ""
> @@ -74,12 +82,7 @@ def go_map_arch(a, d):
> def go_map_arm(a, f, d):
> import re
> if re.match('arm.*', a):
> - if 'armv7' in f:
> - return '7'
> - elif 'armv6' in f:
> - return '6'
> - elif 'armv5' in f:
> - return '5'
> + return f
> return ''
Is this function still useful? Cannot you set TARGET_GOARM and
HOST_GOARM with arm override (to simulate the effect of "re.match('arm.*', a)")?
Regards,
>
> def go_map_386(a, f, d):
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]
next prev parent reply other threads:[~2019-03-18 16:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-18 15:21 [v3][PATCH 1/2] go.bbclass: Export more GO* environment variables Mark Asselstine
2019-03-18 15:21 ` [v3][PATCH 2/2] goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm() Mark Asselstine
2019-03-18 16:40 ` Martin Jansa [this message]
2019-03-18 17:49 ` Mark Asselstine
2019-04-09 21:31 ` richard.purdie
2019-04-09 21:27 ` [v3][PATCH 1/2] go.bbclass: Export more GO* environment variables richard.purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190318164028.GD1994@jama \
--to=martin.jansa@gmail.com \
--cc=mark.asselstine@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.