[PATCH v1] rust: arch/um: Fix loading Rust modules

FUJITA Tomonori tomo at flapping.org
Mon Oct 12 17:13:11 PDT 2026


On Mon, 12 Oct 2026 16:40:50 +0200
Miguel Ojeda <miguel.ojeda.sandonis at gmail.com> wrote:

> On Sun, Oct 4, 2026 at 2:13 PM FUJITA Tomonori <tomo at flapping.org> wrote:
>>
>> arch/um/Makefile adds -Crelocation-model=pie to KBUILD_RUSTFLAGS. This
> 
> Hmm... That was intentionally added by David back in commit
> 905a77077573 ("rust: arch/um: Use 'pie' relocation mode under UML"):
> 
>     UML expects a position independent executable for some reason, so tell
>     rustc to generate pie objects. Otherwise we get a bunch of relocations
>     we can't deal with in libcore.
> 
> So it seems David faced other relocation errors (?).

I think that at that time, vmlinux was linked as PIE with clang,
because -no-pie was not passed to clang. A static libcore cannot be
linked into a PIE, so the errors probably came from that.

Since commit 846cfbeed09b ("um: Fix adding '-no-pie' for clang"),
vmlinux is linked with -no-pie with clang too. So pie is no longer
needed for Rust code, and it breaks modules.



More information about the linux-um mailing list