mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zigit Zo <zig@iorw.io>
To: ojeda@kernel.org, bjorn3_gh@protonmail.com, richard@nod.at,
	anton.ivanov@cambridgegreys.com, johannes@sipsolutions.net,
	tglx@linutronix.de, mingo@redhat.com, nathan@kernel.org,
	ndesaulniers@google.com, gary@garyguo.net
Cc: zig@iorw.io, rust-for-linux@vger.kernel.org,
	linux-um@lists.infradead.org, llvm@lists.linux.dev,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] rust: arch/um: use 'static' relocation model for uml modules
Date: Tue,  3 Sep 2024 21:06:05 +0800	[thread overview]
Message-ID: <FD7D773099A0C7EC+20240903130606.292935-2-zig@iorw.io> (raw)
In-Reply-To: <20240903130606.292935-1-zig@iorw.io>

In the x86_64 UML, kernel modules compiled with Rust will currently
generate some R_X86_64_GOTPCREL relocations, which will then be rejected
by the kernel.

And because of the kernel modules of UML are only got handled by the UML
itself, relocation model 'static' can work as expected other than 'pie'.
---
 arch/um/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 00b63bac5eff..b04b1d4d6dfe 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -63,7 +63,7 @@ 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_RUSTFLAGS_KERNEL += -Crelocation-model=pie
 
 KBUILD_AFLAGS += $(ARCH_INCLUDE)
 
-- 
2.46.0


       reply	other threads:[~2024-09-03 13:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240903130606.292935-1-zig@iorw.io>
2024-09-03 13:06 ` Zigit Zo [this message]
2024-09-04  9:30   ` Geert Stappers
2024-09-04 12:28     ` Zigit Zo
2024-09-03 13:06 ` [PATCH 2/2] rust: arch/um: use 'large' code model for uml Zigit Zo

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=FD7D773099A0C7EC+20240903130606.292935-2-zig@iorw.io \
    --to=zig@iorw.io \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=gary@garyguo.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=ojeda@kernel.org \
    --cc=richard@nod.at \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®