All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Björn Töpel" <bjorn@kernel.org>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>,
	"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>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, nathan@kernel.org,
	linux-kbuild@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE
Date: Thu, 23 Mar 2023 13:01:15 -0700	[thread overview]
Message-ID: <CAFP8O3+UO0x9aETSnOkL7=473mX0wrt+ueuB9UgOJaf+N0p7gw@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdk0Lr-9gt0xAKvkcwA53+Wy8oeYQo1RJ7XH-LKCCURQCQ@mail.gmail.com>

On Wed, Mar 22, 2023 at 11:26 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Feb 24, 2023 at 7:58 AM Björn Töpel <bjorn@kernel.org> wrote:
> >
> > Alexandre Ghiti <alex@ghiti.fr> writes:
> >
> > > +cc linux-kbuild, llvm, Nathan, Nick
> > >
> > > On 2/15/23 15:36, Alexandre Ghiti wrote:
> > >> From: Alexandre Ghiti <alex@ghiti.fr>
> > >>
> > > I tried a lot of things, but I struggle to understand, does anyone have
> > > any idea? FYI, the same problem happens with LLVM.
>
> Off the top of my head, no idea.
>
> (Maybe as a follow up to this series, I wonder if pursuing
> ARCH_HAS_RELR for ARCH=riscv is worthwhile?)

(I had thought about this for my own fun, but the currently only
implementation arch/arm64/kernel/head.S uses assembly.
Every port needs to write some assembly for the same task, which is a pity.
In FreeBSD rtld, glibc, and musl, DT_RELR code is target-independent.)


> >
> > Don't ask me *why*, but adding --emit-relocs to your linker flags solves
> > "the NULL .rela.dyn" both for GCC and LLVM.
> >
> > The downside is that you end up with a bunch of .rela cruft in your
> > vmlinux.
>
> There was a patch just this week to use $(OBJCOPY) to strip these from
> vmlinux (for x86). Looks like x86 uses --emit-relocs for KASLR:
> https://lore.kernel.org/lkml/20230320121006.4863-1-petr.pavlu@suse.com/
> --
> Thanks,
> ~Nick Desaulniers
>


-- 
宋方睿

WARNING: multiple messages have this Message-ID (diff)
From: Fangrui Song <maskray@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Björn Töpel" <bjorn@kernel.org>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>,
	"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>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, nathan@kernel.org,
	linux-kbuild@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE
Date: Thu, 23 Mar 2023 13:01:15 -0700	[thread overview]
Message-ID: <CAFP8O3+UO0x9aETSnOkL7=473mX0wrt+ueuB9UgOJaf+N0p7gw@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdk0Lr-9gt0xAKvkcwA53+Wy8oeYQo1RJ7XH-LKCCURQCQ@mail.gmail.com>

On Wed, Mar 22, 2023 at 11:26 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Feb 24, 2023 at 7:58 AM Björn Töpel <bjorn@kernel.org> wrote:
> >
> > Alexandre Ghiti <alex@ghiti.fr> writes:
> >
> > > +cc linux-kbuild, llvm, Nathan, Nick
> > >
> > > On 2/15/23 15:36, Alexandre Ghiti wrote:
> > >> From: Alexandre Ghiti <alex@ghiti.fr>
> > >>
> > > I tried a lot of things, but I struggle to understand, does anyone have
> > > any idea? FYI, the same problem happens with LLVM.
>
> Off the top of my head, no idea.
>
> (Maybe as a follow up to this series, I wonder if pursuing
> ARCH_HAS_RELR for ARCH=riscv is worthwhile?)

(I had thought about this for my own fun, but the currently only
implementation arch/arm64/kernel/head.S uses assembly.
Every port needs to write some assembly for the same task, which is a pity.
In FreeBSD rtld, glibc, and musl, DT_RELR code is target-independent.)


> >
> > Don't ask me *why*, but adding --emit-relocs to your linker flags solves
> > "the NULL .rela.dyn" both for GCC and LLVM.
> >
> > The downside is that you end up with a bunch of .rela cruft in your
> > vmlinux.
>
> There was a patch just this week to use $(OBJCOPY) to strip these from
> vmlinux (for x86). Looks like x86 uses --emit-relocs for KASLR:
> https://lore.kernel.org/lkml/20230320121006.4863-1-petr.pavlu@suse.com/
> --
> Thanks,
> ~Nick Desaulniers
>


-- 
宋方睿

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Fangrui Song <maskray@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: "Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	linux-kbuild@vger.kernel.org, llvm@lists.linux.dev,
	linux-kernel@vger.kernel.org, nathan@kernel.org,
	"Björn Töpel" <bjorn@kernel.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE
Date: Thu, 23 Mar 2023 13:01:15 -0700	[thread overview]
Message-ID: <CAFP8O3+UO0x9aETSnOkL7=473mX0wrt+ueuB9UgOJaf+N0p7gw@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdk0Lr-9gt0xAKvkcwA53+Wy8oeYQo1RJ7XH-LKCCURQCQ@mail.gmail.com>

On Wed, Mar 22, 2023 at 11:26 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Feb 24, 2023 at 7:58 AM Björn Töpel <bjorn@kernel.org> wrote:
> >
> > Alexandre Ghiti <alex@ghiti.fr> writes:
> >
> > > +cc linux-kbuild, llvm, Nathan, Nick
> > >
> > > On 2/15/23 15:36, Alexandre Ghiti wrote:
> > >> From: Alexandre Ghiti <alex@ghiti.fr>
> > >>
> > > I tried a lot of things, but I struggle to understand, does anyone have
> > > any idea? FYI, the same problem happens with LLVM.
>
> Off the top of my head, no idea.
>
> (Maybe as a follow up to this series, I wonder if pursuing
> ARCH_HAS_RELR for ARCH=riscv is worthwhile?)

(I had thought about this for my own fun, but the currently only
implementation arch/arm64/kernel/head.S uses assembly.
Every port needs to write some assembly for the same task, which is a pity.
In FreeBSD rtld, glibc, and musl, DT_RELR code is target-independent.)


> >
> > Don't ask me *why*, but adding --emit-relocs to your linker flags solves
> > "the NULL .rela.dyn" both for GCC and LLVM.
> >
> > The downside is that you end up with a bunch of .rela cruft in your
> > vmlinux.
>
> There was a patch just this week to use $(OBJCOPY) to strip these from
> vmlinux (for x86). Looks like x86 uses --emit-relocs for KASLR:
> https://lore.kernel.org/lkml/20230320121006.4863-1-petr.pavlu@suse.com/
> --
> Thanks,
> ~Nick Desaulniers
>


-- 
宋方睿

  reply	other threads:[~2023-03-23 20:01 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 14:36 [PATCH v8 0/3] Introduce 64b relocatable kernel Alexandre Ghiti
2023-02-15 14:36 ` Alexandre Ghiti
2023-02-15 14:36 ` [PATCH v8 1/3] riscv: Introduce CONFIG_RELOCATABLE Alexandre Ghiti
2023-02-15 14:36   ` Alexandre Ghiti
2023-02-22 12:29   ` Alexandre Ghiti
2023-02-22 12:29     ` Alexandre Ghiti
2023-02-24 15:58     ` Björn Töpel
2023-02-24 15:58       ` Björn Töpel
2023-03-22 18:25       ` Nick Desaulniers
2023-03-22 18:25         ` Nick Desaulniers
2023-03-22 18:25         ` Nick Desaulniers
2023-03-23 20:01         ` Fangrui Song [this message]
2023-03-23 20:01           ` Fangrui Song
2023-03-23 20:01           ` Fangrui Song
2023-03-24 10:34         ` Alexandre Ghiti
2023-03-24 10:34           ` Alexandre Ghiti
2023-03-24 10:34           ` Alexandre Ghiti
2023-03-22 13:38     ` Alexandre Ghiti
2023-03-22 13:38       ` Alexandre Ghiti
2023-05-09 19:07   ` Andreas Schwab
2023-05-09 19:07     ` Andreas Schwab
2023-05-09 19:07     ` Andreas Schwab
2023-05-09 19:55     ` Alexandre Ghiti
2023-05-09 19:55       ` Alexandre Ghiti
2023-05-09 19:55       ` Alexandre Ghiti
2023-05-11 18:18       ` Andreas Schwab
2023-05-11 18:18         ` Andreas Schwab
2023-05-11 18:18         ` Andreas Schwab
2023-05-12 18:41         ` Palmer Dabbelt
2023-05-12 18:41           ` Palmer Dabbelt
2023-05-12 18:41           ` Palmer Dabbelt
2023-05-19 11:08         ` Alexandre Ghiti
2023-05-19 11:08           ` Alexandre Ghiti
2023-05-19 11:08           ` Alexandre Ghiti
2023-05-19 21:48           ` Andreas Schwab
2023-05-19 21:48             ` Andreas Schwab
2023-05-19 21:48             ` Andreas Schwab
2023-05-19 21:55             ` Palmer Dabbelt
2023-05-19 21:55               ` Palmer Dabbelt
2023-05-19 21:55               ` Palmer Dabbelt
2023-05-22 10:48               ` Alexandre Ghiti
2023-05-22 10:48                 ` Alexandre Ghiti
2023-05-22 10:48                 ` Alexandre Ghiti
2023-02-15 14:36 ` [PATCH v8 2/3] powerpc: Move script to check relocations at compile time in scripts/ Alexandre Ghiti
2023-02-15 14:36   ` Alexandre Ghiti
2023-02-15 14:36   ` Alexandre Ghiti
2023-02-15 14:36 ` [PATCH v8 3/3] riscv: Check relocations at compile time Alexandre Ghiti
2023-02-15 14:36   ` Alexandre Ghiti
2023-02-15 14:36   ` Alexandre Ghiti
2023-02-20  9:14 ` [PATCH v8 0/3] Introduce 64b relocatable kernel Björn Töpel
2023-02-20  9:14   ` Björn Töpel

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='CAFP8O3+UO0x9aETSnOkL7=473mX0wrt+ueuB9UgOJaf+N0p7gw@mail.gmail.com' \
    --to=maskray@google.com \
    --cc=alex@ghiti.fr \
    --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=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.