linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* linker script /arch/arm64/kernel/vmlinux.lds build error
@ 2022-09-06 18:13 Mohan Rao .vanimina
  2022-09-07 10:30 ` Robin Murphy
  0 siblings, 1 reply; 5+ messages in thread
From: Mohan Rao .vanimina @ 2022-09-06 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

Has anyone ever encountered the following issue.
Actually I’m trying to configure the page size for 64KB for the AARCH
64 platform.

Build error:
LTO vmlinux.o
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD  .tmp_vmlinux.kallsymsl
ld.lld: error: k/arch/arm64/kernel/vmlinux.lds:72: symbol not found: PMD_SIZE

I started seeing this build issue after changing the default page size
from ARM64_4K_PAGES to ARM64_64K_PAGES.

patch:
choice
            prompt “Page size”
-          default ARM64_4K_PAGES
+         default ARM64_64K_PAGES
            help
                 Page size ( translation granule) configuration.

Thanks in Advance,
Murali

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linker script /arch/arm64/kernel/vmlinux.lds build error
  2022-09-06 18:13 linker script /arch/arm64/kernel/vmlinux.lds build error Mohan Rao .vanimina
@ 2022-09-07 10:30 ` Robin Murphy
  2022-09-15 15:40   ` Mohan Rao .vanimina
  0 siblings, 1 reply; 5+ messages in thread
From: Robin Murphy @ 2022-09-07 10:30 UTC (permalink / raw)
  To: Mohan Rao .vanimina, linux-arm-kernel

On 2022-09-06 19:13, Mohan Rao .vanimina wrote:
> Has anyone ever encountered the following issue.
> Actually I’m trying to configure the page size for 64KB for the AARCH
> 64 platform.
> 
> Build error:
> LTO vmlinux.o
> MODPOST vmlinux.symvers
> MODINFO modules.builtin.modinfo
> GEN modules.builtin
> LD  .tmp_vmlinux.kallsymsl
> ld.lld: error: k/arch/arm64/kernel/vmlinux.lds:72: symbol not found: PMD_SIZE
> 
> I started seeing this build issue after changing the default page size
> from ARM64_4K_PAGES to ARM64_64K_PAGES.
> 
> patch:
> choice
>              prompt “Page size”
> -          default ARM64_4K_PAGES
> +         default ARM64_64K_PAGES
>              help
>                   Page size ( translation granule) configuration.
> 

It sounds like you've most likely confused the build system into not 
rebuilding everything that should have been rebuilt. Hacking Kconfig 
sources is not the way to change your configuration; you should do that 
by editing .config, either manually or with tools like scripts/config or 
one of the interactive make targets.

However it looks like you're using LTO, so I guess there's also a chance 
that that could be at fault for failing to properly track some 
dependency that the config change affects. If you can still reproduce 
this behaviour by changing your config normally, it might be worth 
raising it with the Clang folks. FWIW I've never seen any issue 
reconfiguring the page size for GCC builds (without LTO).

Robin.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linker script /arch/arm64/kernel/vmlinux.lds build error
  2022-09-07 10:30 ` Robin Murphy
@ 2022-09-15 15:40   ` Mohan Rao .vanimina
  2022-09-20 12:20     ` Mark Rutland
  0 siblings, 1 reply; 5+ messages in thread
From: Mohan Rao .vanimina @ 2022-09-15 15:40 UTC (permalink / raw)
  To: Robin Murphy; +Cc: linux-arm-kernel

Thanks for the info. Sorry for this delay in the response.
As suggested I have modified the PAGE SIZE granularity from
ARM64_4K_PAGES to ARM64_64K_PAGES in the applicable config file but
still the build is failing with the same linker error.
Kindly note that the build compilation is successful for the case of
when configuring PAGE size to ARM64_16K_PAGES. Though there is some
issue that the device is crashing at bootup itself, compilation was
getting through without any issues for ARM64_16K_PAGES.
I wonder why the ARM64_64K_PAGES scenario is failing, there must be
some sanity checks at the build integration(kernel build tests) that
would have been caught this linker build issue if indeed it's really a
bug or failed due to some in-complete change.

Also, there is one more question around this topic that is to change
the PAGE granularity size.
I have came across this patch : Add support for large kernel page
https://lwn.net/Articles/822868/
In what way it is different with the already available PAGE SIZE
Configuration implementation. Could you please clarify?
Thank you in advance for the support.

BR/
Mohan




On Wed, Sep 7, 2022 at 4:00 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2022-09-06 19:13, Mohan Rao .vanimina wrote:
> > Has anyone ever encountered the following issue.
> > Actually I’m trying to configure the page size for 64KB for the AARCH
> > 64 platform.
> >
> > Build error:
> > LTO vmlinux.o
> > MODPOST vmlinux.symvers
> > MODINFO modules.builtin.modinfo
> > GEN modules.builtin
> > LD  .tmp_vmlinux.kallsymsl
> > ld.lld: error: k/arch/arm64/kernel/vmlinux.lds:72: symbol not found: PMD_SIZE
> >
> > I started seeing this build issue after changing the default page size
> > from ARM64_4K_PAGES to ARM64_64K_PAGES.
> >
> > patch:
> > choice
> >              prompt “Page size”
> > -          default ARM64_4K_PAGES
> > +         default ARM64_64K_PAGES
> >              help
> >                   Page size ( translation granule) configuration.
> >
>
> It sounds like you've most likely confused the build system into not
> rebuilding everything that should have been rebuilt. Hacking Kconfig
> sources is not the way to change your configuration; you should do that
> by editing .config, either manually or with tools like scripts/config or
> one of the interactive make targets.
>
> However it looks like you're using LTO, so I guess there's also a chance
> that that could be at fault for failing to properly track some
> dependency that the config change affects. If you can still reproduce
> this behaviour by changing your config normally, it might be worth
> raising it with the Clang folks. FWIW I've never seen any issue
> reconfiguring the page size for GCC builds (without LTO).
>
> Robin.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linker script /arch/arm64/kernel/vmlinux.lds build error
  2022-09-15 15:40   ` Mohan Rao .vanimina
@ 2022-09-20 12:20     ` Mark Rutland
  2022-09-20 15:06       ` Sami Tolvanen
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Rutland @ 2022-09-20 12:20 UTC (permalink / raw)
  To: Mohan Rao .vanimina
  Cc: Robin Murphy, linux-arm-kernel, Sami Tolvanen, Kees Cook,
	Nathan Chancellor, Will Deacon

On Thu, Sep 15, 2022 at 09:10:45PM +0530, Mohan Rao .vanimina wrote:
> Thanks for the info. Sorry for this delay in the response.
> As suggested I have modified the PAGE SIZE granularity from
> ARM64_4K_PAGES to ARM64_64K_PAGES in the applicable config file but
> still the build is failing with the same linker error.
> Kindly note that the build compilation is successful for the case of
> when configuring PAGE size to ARM64_16K_PAGES. Though there is some
> issue that the device is crashing at bootup itself, compilation was
> getting through without any issues for ARM64_16K_PAGES.
> I wonder why the ARM64_64K_PAGES scenario is failing, there must be
> some sanity checks at the build integration(kernel build tests) that
> would have been caught this linker build issue if indeed it's really a
> bug or failed due to some in-complete change.

Since you're using LTO, your config is clearly divergent from defconfig; if you
could share your config it would help a lot.

I suspect what's happening here is exactly what the linker error describes:
you're building a config without a PMD level (e.g. 64K pages with 42-bit VAs),
but there's some code that blindly assumes the PMD level exists and depends on
the non-existent PMD_SIZE definition.

I suspect you've enabled CFI_CLANG, and the TEXT_CFI_JT section in the linker
script, which would explain the problem.

I don't understand why that's aligned to anything more than an instruction
boundary to begin with. I don't see why it would need to be aligned to 2MB with
4K pages, nor with 512MB with 64K pages.

Sami, Kees, Nathan, any idea on where this alignment came from?

Will had mentioned this in passing before as bloating the kernel Image size,
but I hadn't realsied this also caused a build failure until now.

Thanks,
Mark.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linker script /arch/arm64/kernel/vmlinux.lds build error
  2022-09-20 12:20     ` Mark Rutland
@ 2022-09-20 15:06       ` Sami Tolvanen
  0 siblings, 0 replies; 5+ messages in thread
From: Sami Tolvanen @ 2022-09-20 15:06 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Mohan Rao .vanimina, Robin Murphy, linux-arm-kernel, Kees Cook,
	Nathan Chancellor, Will Deacon

On Tue, Sep 20, 2022 at 5:20 AM Mark Rutland <mark.rutland@arm.com> wrote:
>
> On Thu, Sep 15, 2022 at 09:10:45PM +0530, Mohan Rao .vanimina wrote:
> > Thanks for the info. Sorry for this delay in the response.
> > As suggested I have modified the PAGE SIZE granularity from
> > ARM64_4K_PAGES to ARM64_64K_PAGES in the applicable config file but
> > still the build is failing with the same linker error.
> > Kindly note that the build compilation is successful for the case of
> > when configuring PAGE size to ARM64_16K_PAGES. Though there is some
> > issue that the device is crashing at bootup itself, compilation was
> > getting through without any issues for ARM64_16K_PAGES.
> > I wonder why the ARM64_64K_PAGES scenario is failing, there must be
> > some sanity checks at the build integration(kernel build tests) that
> > would have been caught this linker build issue if indeed it's really a
> > bug or failed due to some in-complete change.
>
> Since you're using LTO, your config is clearly divergent from defconfig; if you
> could share your config it would help a lot.
>
> I suspect what's happening here is exactly what the linker error describes:
> you're building a config without a PMD level (e.g. 64K pages with 42-bit VAs),
> but there's some code that blindly assumes the PMD level exists and depends on
> the non-existent PMD_SIZE definition.
>
> I suspect you've enabled CFI_CLANG, and the TEXT_CFI_JT section in the linker
> script, which would explain the problem.
>
> I don't understand why that's aligned to anything more than an instruction
> boundary to begin with. I don't see why it would need to be aligned to 2MB with
> 4K pages, nor with 512MB with 64K pages.
>
> Sami, Kees, Nathan, any idea on where this alignment came from?
>
> Will had mentioned this in passing before as bloating the kernel Image size,
> but I hadn't realsied this also caused a build failure until now.

This was a leftover from an old x86 series, which was included here by
mistake. Will also asked me about this a couple of weeks ago, I think,
and said he'd send a patch to remove it.

Sami

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-20 15:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 18:13 linker script /arch/arm64/kernel/vmlinux.lds build error Mohan Rao .vanimina
2022-09-07 10:30 ` Robin Murphy
2022-09-15 15:40   ` Mohan Rao .vanimina
2022-09-20 12:20     ` Mark Rutland
2022-09-20 15:06       ` Sami Tolvanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).