Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: "Nick Desaulniers" <ndesaulniers@google.com>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy" <christophe.leroy@csgroup.eu>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v9 6/6] riscv: Use --emit-relocs in order to move .rela.dyn in init
Date: Tue, 12 Sep 2023 16:34:36 -0700	[thread overview]
Message-ID: <20230912233331.zejmknzcm5mwzzcz@google.com> (raw)
In-Reply-To: <20230329045329.64565-7-alexghiti@rivosinc.com>

On 2023-03-29, Alexandre Ghiti wrote:
>To circumvent an issue where placing the relocations inside the init
>sections produces empty relocations, use --emit-relocs. But to avoid
>carrying those relocations in vmlinux, use an intermediate
>vmlinux.relocs file which is a copy of vmlinux *before* stripping its
>relocations.
>
>Suggested-by: Björn Töpel <bjorn@kernel.org>
>Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
>Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
>---
> arch/riscv/Makefile          |  2 +-
> arch/riscv/Makefile.postlink | 13 +++++++++++++
> arch/riscv/boot/Makefile     |  7 +++++++
> 3 files changed, 21 insertions(+), 1 deletion(-)
>
>diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
>index 860b09e409c7..7dc6904a6836 100644
>--- a/arch/riscv/Makefile
>+++ b/arch/riscv/Makefile
>@@ -8,7 +8,7 @@
>
> OBJCOPYFLAGS    := -O binary
> ifeq ($(CONFIG_RELOCATABLE),y)
>-	LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro
>+	LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro --emit-relocs
> 	KBUILD_CFLAGS += -fPIE
> endif
> ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
>[...]

(Not subscribed.
b4 am https://lore.kernel.org/all/20230329045329.64565-7-alexghiti@rivosinc.com/
neomutt -f v9_20230329_alexghiti_introduce_64b_relocatable_kernel.mbx)

This commit 559d1e45a16dcf1542e430ea3dce9ab625be98d0 introduced --emit-relocs to arch/riscv/.
I am concerned that --emit-relocs's relocation-type-changing behavior may not be desired and
any new use could become problematic.

https://sourceware.org/bugzilla/show_bug.cgi?id=30844 "ld riscv: --emit-relocs does not retain the original relocation type"

If either -mno-relax or --no-relax is used, --emit-relocs should be fine.

  reply	other threads:[~2023-09-12 23:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29  4:53 [PATCH v9 0/6] Introduce 64b relocatable kernel Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 1/6] riscv: Prepare EFI header for relocatable kernels Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 2/6] riscv: Move .rela.dyn outside of init to avoid empty relocations Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 3/6] riscv: Introduce CONFIG_RELOCATABLE Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 4/6] powerpc: Move script to check relocations at compile time in scripts/ Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 5/6] riscv: Check relocations at compile time Alexandre Ghiti
2023-03-29  4:53 ` [PATCH v9 6/6] riscv: Use --emit-relocs in order to move .rela.dyn in init Alexandre Ghiti
2023-09-12 23:34   ` Fangrui Song [this message]
2023-04-19 14:56 ` [PATCH v9 0/6] Introduce 64b relocatable kernel Palmer Dabbelt
2023-04-20 17:40 ` patchwork-bot+linux-riscv
2023-04-21 18:59 ` Palmer Dabbelt
2023-04-21 19:10   ` Konstantin Ryabitsev
2023-04-21 19:24     ` Conor Dooley

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=20230912233331.zejmknzcm5mwzzcz@google.com \
    --to=maskray@google.com \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bjorn@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mpe@ellerman.id.au \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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