From: sunilkumar.dora@windriver.com
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, alex.kanavin@gmail.com,
sundeep.kokkonda@windriver.com, Randy.MacLeod@windriver.com,
Deepesh.Varatharajan@windriver.com
Subject: [scarthgap][PATCH 2/2] rust: enable dynamic LLVM linking by default
Date: Thu, 19 Nov 2026 19:28:46 -0800 [thread overview]
Message-ID: <20261120032846.2692732-3-sunilkumar.dora@windriver.com> (raw)
In-Reply-To: <20261120032846.2692732-1-sunilkumar.dora@windriver.com>
From: Sunil Dora <sunilkumar.dora@windriver.com>
Backport of master "rust: enable dynamic LLVM linking by default" [1].
On master rust links against the llvm recipe, here against rust-llvm
which provides libLLVM-17.so now.
rustc segfaults (e.g. in llvm::X86ReadAdvanceTable) when
rust-llvm-native comes from sstate built on a host with binutils >= 2.45
and rust-native is linked on a host with an older ld.
This is binutils PR ld/32991 [2]: newer gas emits R_X86_64_GOTPCRELX for
"push foo@GOTPCREL(%rip)" and an ld without the fix rewrites the push
into a call, so the statically linked LLVM code in librustc_driver jumps
into data at runtime. scarthgap links the static rust-llvm libs the same
way master did before the fix.
With dynamic linking the host ld only sees the exported symbols of
libLLVM and does not relink any LLVM code.
Add llvm-shared PACKAGECONFIG, default on for native, nativesdk and
target like master. Native only is not enough, target rust bootstraps
its own rustc with the target settings and crashes the same way. Remove
llvm-shared to get the static build back.
Selftest image installs rust-llvm-libllvm now, the test binaries need
it (master installs llvm there).
[1] https://git.openembedded.org/openembedded-core/commit/?id=d0671c3dad87a063b3a41dd07cde89b5684e692c
[2] https://sourceware.org/bugzilla/show_bug.cgi?id=32991
[YOCTO #16058]
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
meta/lib/oeqa/selftest/cases/rust.py | 2 +-
meta/recipes-devtools/rust/rust_1.75.0.bb | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/cases/rust.py b/meta/lib/oeqa/selftest/cases/rust.py
index 26f132edc4..b2ad7c099f 100644
--- a/meta/lib/oeqa/selftest/cases/rust.py
+++ b/meta/lib/oeqa/selftest/cases/rust.py
@@ -51,7 +51,7 @@ class RustSelfTestSystemEmulated(OESelftestTestCase, OEPTestResultTestCase):
bitbake("{} -c test_compile".format(recipe))
builddir = get_bb_var("RUSTSRC", "rust")
# build core-image-minimal with required packages
- default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp"]
+ default_installed_packages = ["libgcc", "libstdc++", "libatomic", "libgomp", "rust-llvm-libllvm"]
features = []
features.append('IMAGE_FEATURES += "ssh-server-dropbear"')
features.append('CORE_IMAGE_EXTRA_INSTALL += "{0}"'.format(" ".join(default_installed_packages)))
diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb
index b9348bf050..b2fac12428 100644
--- a/meta/recipes-devtools/rust/rust_1.75.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.75.0.bb
@@ -20,6 +20,9 @@ DEPENDS += "rust-llvm (=${PV})"
RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"
+PACKAGECONFIG ??= "llvm-shared"
+PACKAGECONFIG[llvm-shared] = ",,,"
+
# 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
@@ -128,6 +131,7 @@ python do_configure() {
# [llvm]
config.add_section("llvm")
+ config.set("llvm", "link-shared", e(bb.utils.contains('PACKAGECONFIG', 'llvm-shared', True, False, d)))
config.set("llvm", "static-libstdcpp", e(False))
if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""):
config.set("llvm", "use-libcxx", e(True))
--
2.49.0
prev parent reply other threads:[~2026-11-20 3:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 3:28 [scarthgap][PATCH 0/2] rust: link LLVM dynamically sunilkumar.dora
2026-11-20 3:28 ` [scarthgap][PATCH 1/2] rust-llvm: build and install the LLVM shared library sunilkumar.dora
2026-11-20 3:28 ` sunilkumar.dora [this message]
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=20261120032846.2692732-3-sunilkumar.dora@windriver.com \
--to=sunilkumar.dora@windriver.com \
--cc=Deepesh.Varatharajan@windriver.com \
--cc=Randy.MacLeod@windriver.com \
--cc=alex.kanavin@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=sundeep.kokkonda@windriver.com \
--cc=yoann.congal@smile.fr \
/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.