[PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML

David Gow posted 3 patches 2 years, 9 months ago
[PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML
Posted by David Gow 2 years, 9 months ago
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>
---
 arch/um/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index f1d4d67157be..ae321282dc6f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -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))) \
-- 
2.39.0.314.g84b9a713c41-goog
Re: [PATCH 1/3] rust: arch/um: Use 'pie' relocation mode under UML
Posted by Thomas Meyer 2 years, 8 months ago
Hi,


Am 17. Dezember 2022 05:44:34 MEZ schrieb David Gow <davidgow@google.com>:
>UML expects a position independent executable for some reason, 

I think I did add this to make UML build on Debian...

> 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>
>---
> arch/um/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/arch/um/Makefile b/arch/um/Makefile
>index f1d4d67157be..ae321282dc6f 100644
>--- a/arch/um/Makefile
>+++ b/arch/um/Makefile
>@@ -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))) \

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.