All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com>
To: Otavio Salvador <otavio@ossystems.com.br>,
	openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH v2 1/2] rust-common: Fix use of target definitions for SDK generation
Date: Wed, 13 Jul 2022 18:08:10 -0600	[thread overview]
Message-ID: <017e9264-cb7e-9904-7746-56cc461196da@linux.microsoft.com> (raw)
In-Reply-To: <20220710164300.953098-1-otavio@ossystems.com.br>

[-- Attachment #1: Type: text/plain, Size: 5155 bytes --]


On 7/10/22 10:42, Otavio Salvador wrote:
> We need full target passed for build so we changed the
> rust-cross-canadian to use same code used in regular rust recipes and
> added support to use specific llvm-target for the building host.
>
> Fixes: ef566af964 ("rust: fix issue building cross-canadian tools for aarch64 on x86_64")
> Fixes: bd36593ba3 ("rust-common: Drop LLVM_TARGET and simplify")
> Fixes: 8ed000debb ("rust-common: Fix for target definitions returning 'NoneType' for arm")
> Signed-off-by: Otavio Salvador<otavio@ossystems.com.br>
> ---
>
> Changes in v2:
> - Fix syntax for newer Python
>
>   meta/recipes-devtools/rust/rust-common.inc    | 21 ++++++++++++------
>   .../rust/rust-cross-canadian-common.inc       | 22 ++++++++++++++++---
>   2 files changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
> index ef70c48d0f..a937d58a37 100644
> --- a/meta/recipes-devtools/rust/rust-common.inc
> +++ b/meta/recipes-devtools/rust/rust-common.inc
> @@ -119,12 +119,12 @@ def llvm_features(d):
>   
>   
>   ## arm-unknown-linux-gnueabihf
> -DATA_LAYOUT[arm] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> -TARGET_ENDIAN[arm] = "little"
> -TARGET_POINTER_WIDTH[arm] = "32"
> -TARGET_C_INT_WIDTH[arm] = "32"
> -MAX_ATOMIC_WIDTH[arm] = "64"
> -FEATURES[arm] = "+v6,+vfp2"
> +DATA_LAYOUT[arm-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> +TARGET_ENDIAN[arm-eabi] = "little"
> +TARGET_POINTER_WIDTH[arm-eabi] = "32"
> +TARGET_C_INT_WIDTH[arm-eabi] = "32"
> +MAX_ATOMIC_WIDTH[arm-eabi] = "64"
> +FEATURES[arm-eabi] = "+v6,+vfp2"
>   
>   ## armv7-unknown-linux-gnueabihf
>   DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
> @@ -304,12 +304,19 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
>       else:
>           arch_abi = rust_arch
>   
> +    # When building for the building system we need to return the HOST target
> +    # or wrong flags are used.
> +    if thing == "BUILD":
> +        llvm_target = d.getVar('RUST_HOST_SYS', arch_abi)
> +    else:
> +        llvm_target = d.getVar('RUST_TARGET_SYS', arch_abi)
> +
>       features = features or d.getVarFlag('FEATURES', arch_abi) or ""
>       features = features.strip()
>   
>       # build tspec
>       tspec = {}
> -    tspec['llvm-target'] = d.getVar('RUST_TARGET_SYS', arch_abi)
> +    tspec['llvm-target'] = llvm_target
>       tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi)
>       tspec['max-atomic-width'] = int(d.getVarFlag('MAX_ATOMIC_WIDTH', arch_abi))
>       tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
> diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
> index 1f21c8af26..eff9212648 100644
> --- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
> +++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
> @@ -27,9 +27,23 @@ DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDP
>   
>   python do_rust_gen_targets () {
>       wd = d.getVar('WORKDIR') + '/targets/'
> -    rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
> -    rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
> -    rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
> +    # It is important 'TARGET' is last here so that it overrides our less
> +    # informed choices for BUILD & HOST if TARGET happens to be the same as
> +    # either of them.
> +    for thing in ['BUILD', 'HOST', 'TARGET']:
> +        bb.debug(1, "rust_gen_target for " + thing)
> +        features = ""
> +        cpu = "generic"
> +        arch = d.getVar('{}_ARCH'.format(thing))
> +        abi = ""
> +        if thing is "TARGET":
> +            abi = d.getVar('ABIEXTENSION')
> +            # arm and armv7 have different targets in llvm
> +            if arch == "arm" and target_is_armv7(d):
> +                arch = 'armv7'
> +            features = d.getVar('TARGET_LLVM_FEATURES') or ""
> +            cpu = d.getVar('TARGET_LLVM_CPU')
> +        rust_gen_target(d, thing, wd, features, cpu, arch, abi)
>   }
>   
>   INHIBIT_DEFAULT_RUST_DEPS = "1"
> @@ -45,6 +59,8 @@ python do_configure:prepend() {
>       hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
>   }
>   
> +INSANE_SKIP:${PN} = "libdir"
> +
>   INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
>   SKIP_FILEDEPS:${RUSTLIB_TARGET_PN} = "1"


These look okay to me, could we backport these to Kirkstone?

Alejandro


>   
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#167848):https://lists.openembedded.org/g/openembedded-core/message/167848
> Mute This Topic:https://lists.openembedded.org/mt/92292890/4354175
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub  [alhe@linux.microsoft.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>

[-- Attachment #2: Type: text/html, Size: 6180 bytes --]

  parent reply	other threads:[~2022-07-14  0:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 16:42 [PATCH v2 1/2] rust-common: Fix use of target definitions for SDK generation Otavio Salvador
2022-07-10 16:43 ` [PATCH v2 2/2] cargo-cross-canadian: Use SDK's flags during target linking Otavio Salvador
2022-07-18 12:45   ` [OE-core] " Richard Purdie
2022-07-18 15:49     ` Otavio Salvador
2022-07-18 15:59       ` Richard Purdie
2022-07-18 19:25         ` Otavio Salvador
2022-07-18 21:18           ` Richard Purdie
2022-07-18 21:41             ` Otavio Salvador
2022-07-18 22:54               ` Richard Purdie
2022-07-19  0:07                 ` Otavio Salvador
2022-07-20 17:21                   ` Richard Purdie
2022-07-20 18:11                     ` Otavio Salvador
2022-07-20 18:26                       ` Richard Purdie
2022-07-20 19:13                       ` Otavio Salvador
2022-07-13 16:05 ` [PATCH v2 1/2] rust-common: Fix use of target definitions for SDK generation Sundeep KOKKONDA
2022-07-14  0:08 ` Alejandro Enedino Hernandez Samaniego [this message]
2022-07-14 11:24   ` [OE-core] " Otavio Salvador

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=017e9264-cb7e-9904-7746-56cc461196da@linux.microsoft.com \
    --to=alhe@linux.microsoft.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=otavio@ossystems.com.br \
    /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.