From: Conor Dooley <conor@kernel.org>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Andreas Schwab <schwab@linux-m68k.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie
Date: Sun, 28 May 2023 14:56:38 +0100 [thread overview]
Message-ID: <20230528-uneatable-earpiece-3f8673548863@spud> (raw)
In-Reply-To: <cf0d2d2a-c407-7b3d-a5ab-ea5c19e7b890@ghiti.fr>
[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]
On Sun, May 28, 2023 at 03:42:59PM +0200, Alexandre Ghiti wrote:
> Hmmm, it still works for me with both clang and gcc-9.
gcc-9 is a bit of a relic, do you have more recent compilers lying
around? If not, I can try some older compilers at some point.
> You don't have to do that now but is there a way I could get your compiled
> image? With the sha1 used to build it? Sorry, I don't see what happens, I
> need to get my hands dirty in some debug!
What do you mean by "sha1"? It falls with v6.4-rc1 which is a stable
hash, if that's what you're looking for.
Otherwise,
https://github.com/ConchuOD/riscv-env/releases/download/v2022.03/vmlinux.bin
(ignore the release crap haha, too lazy to find a proper hosting
mechanism)
| git show
| commit 3bd124485ed55d8ee6c1ff3532c8f617b24aa6ef (HEAD)
| Author: Alexandre Ghiti <alexghiti@rivosinc.com>
| Date: Fri May 26 17:46:30 2023 +0200
|
| riscv: Fix relocatable kernels with early alternatives using -fno-pie
|
| Early alternatives are called with the mmu disabled, and then should not
| access any global symbols through the GOT since it requires relocations,
| relocations that we do before but *virtually*. So only use medany code
| model for this early code.
|
| Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
| Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
|
| diff --git a/arch/riscv/errata/Makefile b/arch/riscv/errata/Makefile
| index a1055965fbee..7b2637c8c332 100644
| --- a/arch/riscv/errata/Makefile
| +++ b/arch/riscv/errata/Makefile
| @@ -1,2 +1,6 @@
| +ifdef CONFIG_RELOCATABLE
| +KBUILD_CFLAGS += -fno-pie
| +endif
| +
| obj-$(CONFIG_ERRATA_SIFIVE) += sifive/
| obj-$(CONFIG_ERRATA_THEAD) += thead/
| diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile
| index fbdccc21418a..153864e4f399 100644
| --- a/arch/riscv/kernel/Makefile
| +++ b/arch/riscv/kernel/Makefile
| @@ -23,6 +23,10 @@ ifdef CONFIG_FTRACE
| CFLAGS_REMOVE_alternative.o = $(CC_FLAGS_FTRACE)
| CFLAGS_REMOVE_cpufeature.o = $(CC_FLAGS_FTRACE)
| endif
| +ifdef CONFIG_RELOCATABLE
| +CFLAGS_alternative.o += -fno-pie
| +CFLAGS_cpufeature.o += -fno-pie
| +endif
| ifdef CONFIG_KASAN
| KASAN_SANITIZE_alternative.o := n
| KASAN_SANITIZE_cpufeature.o := n
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2023-05-28 13:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 15:46 [PATCH -fixes] riscv: Fix relocatable kernels with early alternatives using -fno-pie Alexandre Ghiti
2023-05-26 16:24 ` Conor Dooley
2023-05-26 16:35 ` Conor Dooley
2023-05-27 9:13 ` Alexandre Ghiti
2023-05-27 10:02 ` Conor Dooley
2023-05-28 13:00 ` Alexandre Ghiti
2023-05-28 13:12 ` Conor Dooley
2023-05-28 13:42 ` Alexandre Ghiti
2023-05-28 13:56 ` Conor Dooley [this message]
2023-05-29 18:51 ` Alexandre Ghiti
2023-05-29 19:06 ` Conor Dooley
2023-05-29 19:37 ` Alexandre Ghiti
2023-05-30 11:27 ` Conor Dooley
2023-05-30 14:33 ` Alexandre Ghiti
2023-05-30 17:47 ` Conor Dooley
2023-05-30 18:04 ` Alexandre Ghiti
2023-05-30 20:22 ` Conor Dooley
2023-05-31 7:26 ` Alexandre Ghiti
2023-05-31 9:32 ` Conor Dooley
2023-05-31 11:03 ` Alexandre Ghiti
2023-05-26 16:38 ` Alexandre Ghiti
2023-05-31 15:03 ` Palmer Dabbelt
2023-05-31 15:10 ` patchwork-bot+linux-riscv
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=20230528-uneatable-earpiece-3f8673548863@spud \
--to=conor@kernel.org \
--cc=alex@ghiti.fr \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=schwab@linux-m68k.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