From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25442C433EF for ; Thu, 16 Dec 2021 10:06:19 +0000 (UTC) Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) by mx.groups.io with SMTP id smtpd.web12.8831.1639649177976464278 for ; Thu, 16 Dec 2021 02:06:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JgU0vGQ2; spf=pass (domain: gmail.com, ip: 209.85.221.181, mailfrom: alex.kanavin@gmail.com) Received: by mail-vk1-f181.google.com with SMTP id o2so304550vkn.0 for ; Thu, 16 Dec 2021 02:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UyVLvkUgql/Xo4Z6mnVKsRC6Jk2PS5C0G0RgMHhGiBU=; b=JgU0vGQ2tLwUPahYdTlbtNghCqFaoxO6AdaEGJvVYoVyGKW8Rj6TZFRvXI3xFKi4Mx wNrhxW8VV7UhzQNXbEGecOrA3wl97JUrBbun2j6Jswu0wRTdsMAzU1q8RYxKegyYbzKu ppp3OXyt/ZOqvJu1gb6KEHgASHRJZwrTdIkrKwcbpLqnMxRdtWJXAWIxVY17Fs4JWfFF 7R1swj3irOmT3JGJ1Ikj+SGaT7KevfOM2UE9Gi+FRoYcWF0Pd3nx+CZdDjUKHykcLJin d7oFZHnxqZeoUQthgw96MUQl+77biZBvfMG1eKRN48JosU2XkEzKG1k0gBDflbJgPGj0 nInQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UyVLvkUgql/Xo4Z6mnVKsRC6Jk2PS5C0G0RgMHhGiBU=; b=Dpl/khIiu37BzOUXrCS6jGj6lnX/2OajCviIyF5jVtsOYbUGEZbXl1Sw33X4CSrCic rrrqhlvBnPN58wIvBxyXLHLxcNtHnULI6PQ7t0yw9cz8ScmHxaEd/6xyuP0adUzN2sze oDjTP5lTUvWogGzMX+iIiSaAo0nZ5NDb6C9MbxpiO3+eHMwMa3vki0PuEL5Kkli8QY28 Sa8zrBIy79kLnRIkDz9RRay5VxM/4QX9m6/DImVF0h/6WxXMamBbVhdw1cNgHXqvU0wA RWjooU1mbq3/UWyT3f2JE/Ojai1GKX/iwFLIEB954VmEBv1v8+MnfwF3PkCMlcR9xCTk GmZA== X-Gm-Message-State: AOAM5324CwqcdEbT8djg9B1NgEqn5Mfgy0N5j80uIRqpJ6AgSWgIV6nJ JDjUhTZ2PrrwpgFWYiFnGOTRxdGjLOtrhPZCMlg080FaDf+9wQ== X-Google-Smtp-Source: ABdhPJwy45uN7n25OtBAfk+4+oqtQ6StaBHwftTzJpiBLVj9W8orBVtMawILbru4tmoPD5fE/DKTjbKm3wmBDNP8eJ0= X-Received: by 2002:a1f:c3c2:: with SMTP id t185mr1449253vkf.1.1639649177047; Thu, 16 Dec 2021 02:06:17 -0800 (PST) MIME-Version: 1.0 References: <20211216091940.GE5920@codepurple> In-Reply-To: <20211216091940.GE5920@codepurple> From: Alexander Kanavin Date: Thu, 16 Dec 2021 11:06:05 +0100 Message-ID: Subject: Re: [OE-core] [PATCH] rust: fix arm64 link failures when building rust apps To: "S. Lockwood-Childs" Cc: OE-core Content-Type: multipart/alternative; boundary="000000000000c1170305d3409253" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 16 Dec 2021 10:06:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/159775 --000000000000c1170305d3409253 Content-Type: text/plain; charset="UTF-8" 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 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 > --- > 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 > + > +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 { > + // -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] > -=-=-=-=-=-=-=-=-=-=-=- > > --000000000000c1170305d3409253 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Discussion in https://github.com/rust-lang/git2-rs/pull/759 doesn&= #39;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 c= ase 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 exam= ple, librsvg)
for aarch64 targets looks like:
=C2=A0 undefined references to `__aarch64_ldadd8_rel'

The upstream rust commit
"add target feature outline-atomics" 0f9f241aac21bc77fb9e757da182= 07abefdc841d
has caused a number of such link failure regressions on platforms with aarc= h64
toolchains that are not able to cope with -moutline-atomics flag. This incl= udes
musl toolchains [1] but some glibc toolchains also are not able to handle t= his
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<= br> 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=3D1830472

Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
---
=C2=A0meta/recipes-devtools/rust/rust-target.inc=C2=A0 =C2=A0 |=C2=A0 2 + =C2=A0.../rust/rust-disable-outline-atomics.patch=C2=A0 =C2=A0| 50 ++++++++= +++++++++++
=C2=A02 files changed, 52 insertions(+)
=C2=A0create mode 100644 meta/recipes-devtools/rust/rust/rust-disable-outli= ne-atomics.patch

diff --git a/meta/recipes-devtools/rust/rust-target.inc b/meta/recipes-devt= ools/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

=C2=A0DEPENDS +=3D "rust-llvm (=3D${PV})"

+SRC_URI +=3D "file://rust-disable-outline-atomics.patch"
+
=C2=A0# Otherwise we'll depend on what we provide
=C2=A0INHIBIT_DEFAULT_RUST_DEPS:class-native =3D "1"
=C2=A0# 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.p= atch 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:
+=C2=A0 undefined references to `__aarch64_ldadd8_rel'
+
+The upstream rust commit
+"add target feature outline-atomics" 0f9f241aac21bc77fb9e757da18= 207abefdc841d
+has caused a number of such link failure regressions on platforms with aar= ch64
+toolchains that are not able to cope with -moutline-atomics flag. This inc= ludes
+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<= /a>
+[2]
https://www.mail-archive.com/gc= c-bugs@gcc.gnu.org/msg661738.html
+[3] https://bugzilla.redhat.com/show_bug.cgi?= id=3D1830472
+
+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_c= odegen_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> {
+=C2=A0 =C2=A0 =C2=A0// -Ctarget-features
+=C2=A0 =C2=A0 =C2=A0features.extend(sess.opts.cg.target_feature.split(',').flat_map(&am= p;filter));
+
+-=C2=A0 =C2=A0 // FIXME: Move outline-atomics to target definition when ea= rliest supported LLVM is 12.
+-=C2=A0 =C2=A0 if get_version() >=3D (12, 0, 0)
+-=C2=A0 =C2=A0 =C2=A0 =C2=A0 && sess.target.llvm_target.contains(&= quot;aarch64-unknown-linux")
+-=C2=A0 =C2=A0 =C2=A0 =C2=A0 && sess.target.llvm_target !=3D "= ;aarch64-unknown-linux-musl"
+-=C2=A0 =C2=A0 {
+-=C2=A0 =C2=A0 =C2=A0 =C2=A0 features.push("+outline-atomics".to= _string());
+-=C2=A0 =C2=A0 }
++//=C2=A0 =C2=A0 // FIXME: Move outline-atomics to target definition when = earliest supported LLVM is 12.
++//=C2=A0 =C2=A0 if get_version() >=3D (12, 0, 0)
++//=C2=A0 =C2=A0 =C2=A0 =C2=A0 && sess.target.llvm_target.contains= ("aarch64-unknown-linux")
++//=C2=A0 =C2=A0 =C2=A0 =C2=A0 && sess.target.llvm_target !=3D &qu= ot;aarch64-unknown-linux-musl"
++//=C2=A0 =C2=A0 {
++//=C2=A0 =C2=A0 =C2=A0 =C2=A0 features.push("+outline-atomics".= to_string());
++//=C2=A0 =C2=A0 }
++
+
+=C2=A0 =C2=A0 =C2=A0features
+ }
--
2.20.1


-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
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<= br> Unsubscribe: https://lists.openembedded.org/= g/openembedded-core/unsub [alex.kanavin@gmail.com]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-

--000000000000c1170305d3409253--