linker script /arch/arm64/kernel/vmlinux.lds build error

Mark Rutland mark.rutland at arm.com
Tue Sep 20 05:20:27 PDT 2022


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.



More information about the linux-arm-kernel mailing list