Re: [PATCH v2] MIPS: move _stext definition to vmlinux.lds.S
From: Masahiro Yamada
Date: Wed Nov 13 2024 - 16:20:05 EST
On Thu, Nov 14, 2024 at 3:13 AM Rong Xu <xur@xxxxxxxxxx> wrote:
>
> "
>
> On Wed, Nov 13, 2024 at 7:55 AM Maciej W. Rozycki <macro@xxxxxxxxxxx> wrote:
> >
> > On Tue, 12 Nov 2024, Rong Xu wrote:
> >
> > > The _stext symbol is intended to reference the start of the text section.
> > > However, it currently relies on a fragile link order because the existing
> > > EXPORT(_stext) resides within the .text section, which is not guaranteed
> > > to be placed first.
> >
> > Umm, arch/mips/kernel/head.S does mean to be linked first. We rely on it
> > for environments where there's no entry point is available and execution
> > starts from the beginning of the image. See the comment right below your
> > change.
> >
> When you said "arch/mips/kernel/head.S does mean to be linked first", is it
> a hard requirement in mips? This patch only moves _stext but leaves other
> symbols from heads.S for TEXT_TEXT macro to order. For example,
> __kernel_entry is placed in the middle of the text segment.
>
> If we want head.S to be linked first, I can change the patch to place
> all symbols from head.S before TEXT_TEXT.
No change is needed for this.
arch/mips/kernel/head.o is always passed to the linker first.
This is guaranteed by scripts/head-object-list.txt
--
Best Regards
Masahiro Yamada