All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex.kanavin@gmail.com>
To: "S. Lockwood-Childs" <sjl@vctlabs.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] rust: fix arm64 link failures when building rust apps
Date: Thu, 16 Dec 2021 11:06:05 +0100	[thread overview]
Message-ID: <CANNYZj8P_HUt_+UNM4nZee5bksj8LahQHgW+2Uzt5wSGdY4Oeg@mail.gmail.com> (raw)
In-Reply-To: <20211216091940.GE5920@codepurple>

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

Discussion in https://github.com/rust-lang/git2-rs/pull/759 doesn't exactly
fill one with confidence, but still, can this be handled and fixed in rust
upstream? Non-upstreamable patches for what is a common use case aren't a
good idea.

Alex

On Thu, 16 Dec 2021 at 10:19, S. Lockwood-Childs <sjl@vctlabs.com> wrote:

> Typical error when trying to build a rust app (for example, librsvg)
> for aarch64 targets looks like:
>   undefined references to `__aarch64_ldadd8_rel'
>
> The upstream rust commit
> "add target feature outline-atomics"
> 0f9f241aac21bc77fb9e757da18207abefdc841d
> has caused a number of such link failure regressions on platforms with
> aarch64
> toolchains that are not able to cope with -moutline-atomics flag. This
> includes
> musl toolchains [1] but some glibc toolchains also are not able to handle
> this
> flag [2,3]
>
> OE gcc-cross-aarch64 is currently one of the latter, but when it *is* able
> to
> handle outline-atomics this patch should go away, to take advantage of the
> reported performance benefit.
>
> [1] https://github.com/rust-lang/git2-rs/issues/706
> [2] https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg661738.html
> [3] https://bugzilla.redhat.com/show_bug.cgi?id=1830472
>
> Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
> ---
>  meta/recipes-devtools/rust/rust-target.inc    |  2 +
>  .../rust/rust-disable-outline-atomics.patch   | 50 +++++++++++++++++++
>  2 files changed, 52 insertions(+)
>  create mode 100644
> meta/recipes-devtools/rust/rust/rust-disable-outline-atomics.patch
>
> diff --git a/meta/recipes-devtools/rust/rust-target.inc
> b/meta/recipes-devtools/rust/rust-target.inc
> index 3f637b3ba5..bac743f66d 100644
> --- a/meta/recipes-devtools/rust/rust-target.inc
> +++ b/meta/recipes-devtools/rust/rust-target.inc
> @@ -2,6 +2,8 @@ require rust.inc
>
>  DEPENDS += "rust-llvm (=${PV})"
>
> +SRC_URI += "file://rust-disable-outline-atomics.patch"
> +
>  # Otherwise we'll depend on what we provide
>  INHIBIT_DEFAULT_RUST_DEPS:class-native = "1"
>  # We don't need to depend on gcc-native because yocto assumes it exists
> diff --git
> a/meta/recipes-devtools/rust/rust/rust-disable-outline-atomics.patch
> b/meta/recipes-devtools/rust/rust/rust-disable-outline-atomics.patch
> new file mode 100644
> index 0000000000..fc99a06a6a
> --- /dev/null
> +++ b/meta/recipes-devtools/rust/rust/rust-disable-outline-atomics.patch
> @@ -0,0 +1,50 @@
> +rust: fix arm64 link failures when building rust apps
> +
> +Typical error when trying to build a rust app looks like:
> +  undefined references to `__aarch64_ldadd8_rel'
> +
> +The upstream rust commit
> +"add target feature outline-atomics"
> 0f9f241aac21bc77fb9e757da18207abefdc841d
> +has caused a number of such link failure regressions on platforms with
> aarch64
> +toolchains that are not able to cope with -moutline-atomics flag. This
> includes
> +musl toolchains [1] but some glibc toolchains also are not able to handle
> this
> +flag [2,3]
> +
> +OE gcc-cross-aarch64 is currently one of the latter, but when it *is*
> able to
> +handle outline-atomics this patch should go away, to take advantage of the
> +reported performance benefit.
> +
> +[1] https://github.com/rust-lang/git2-rs/issues/706
> +[2] https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg661738.html
> +[3] https://bugzilla.redhat.com/show_bug.cgi?id=1830472
> +
> +Upstream-Status: Inappropriate [other]
> +
> +Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
> +
> +diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs
> b/compiler/rustc_codegen_llvm/src/llvm_util.rs
> +index c2136f161..ca221eb4a 100644
> +--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
> ++++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
> +@@ -416,13 +416,14 @@ pub fn llvm_global_features(sess: &Session) ->
> Vec<String> {
> +     // -Ctarget-features
> +     features.extend(sess.opts.cg
> .target_feature.split(',').flat_map(&filter));
> +
> +-    // FIXME: Move outline-atomics to target definition when earliest
> supported LLVM is 12.
> +-    if get_version() >= (12, 0, 0)
> +-        && sess.target.llvm_target.contains("aarch64-unknown-linux")
> +-        && sess.target.llvm_target != "aarch64-unknown-linux-musl"
> +-    {
> +-        features.push("+outline-atomics".to_string());
> +-    }
> ++//    // FIXME: Move outline-atomics to target definition when earliest
> supported LLVM is 12.
> ++//    if get_version() >= (12, 0, 0)
> ++//        && sess.target.llvm_target.contains("aarch64-unknown-linux")
> ++//        && sess.target.llvm_target != "aarch64-unknown-linux-musl"
> ++//    {
> ++//        features.push("+outline-atomics".to_string());
> ++//    }
> ++
> +
> +     features
> + }
> --
> 2.20.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159774):
> https://lists.openembedded.org/g/openembedded-core/message/159774
> Mute This Topic: https://lists.openembedded.org/mt/87763768/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

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

  reply	other threads:[~2021-12-16 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16  9:19 [PATCH] rust: fix arm64 link failures when building rust apps S. Lockwood-Childs
2021-12-16 10:06 ` Alexander Kanavin [this message]
2021-12-16 23:04 ` S. Lockwood-Childs
2021-12-17 13:11   ` [OE-core] " Alex Kiernan

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=CANNYZj8P_HUt_+UNM4nZee5bksj8LahQHgW+2Uzt5wSGdY4Oeg@mail.gmail.com \
    --to=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=sjl@vctlabs.com \
    /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.