rust: arch/um: Use 'pie' relocation mode under UML
authorDavid Gow <davidgow@google.com>
Sat, 17 Dec 2022 04:44:34 +0000 (12:44 +0800)
committerRichard Weinberger <richard@nod.at>
Fri, 10 Feb 2023 20:27:32 +0000 (21:27 +0100)
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.

Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/Makefile

index f1d4d67157be0bf568ca476aed3508b9c9fd2f8f..ae321282dc6f60429486b012bf5da24e57e88c79 100644 (file)
@@ -68,6 +68,8 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
        -Din6addr_loopback=kernel_in6addr_loopback \
        -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
 
+KBUILD_RUSTFLAGS += -Crelocation-model=pie
+
 KBUILD_AFLAGS += $(ARCH_INCLUDE)
 
 USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \