[PATCH 2/2] rust: arch/um: use 'large' code model for uml

Zigit Zo zig at iorw.io
Tue Sep 3 06:06:06 PDT 2024


The Rust modules compiled against UML should be 'large', without this
the compiler will generate some R_X86_64_32S relocations, but UML is
running at userspace with signed-address larger than zero, therefore
makes '__write_relocate_add' treating the relocation as overflowed.
---
 arch/um/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index b04b1d4d6dfe..c2a9f2102ba7 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -32,6 +32,7 @@ endif
 
 ifdef CONFIG_64BIT
 	KBUILD_CFLAGS += -mcmodel=large
+	KBUILD_RUSTFLAGS += -Ccode-model=large
 endif
 
 HOST_DIR := arch/$(HEADER_ARCH)
-- 
2.46.0




More information about the linux-um mailing list