Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* hexagon: allmodconfig does not link with LLVM 17 and 18
@ 2026-11-19  5:49 Tzu-Ching Yang
  2026-11-19 15:29 ` Brian Cain
  2026-11-19 19:51 ` Nathan Chancellor
  0 siblings, 2 replies; 3+ messages in thread
From: Tzu-Ching Yang @ 2026-11-19  5:49 UTC (permalink / raw)
  To: Brian Cain; +Cc: linux-hexagon, Nathan Chancellor, llvm, linux-kernel

Hi Brian,

hexagon allmodconfig does not link with LLVM 17 and 18, on mainline
and on stable. Your hexagon-qemu-virt branch has the fix, 09df35bd9d9f
("hexagon: constant-extend head.S calls to out-of-file symbols");
could it go to hexagon-fixes, with Cc: stable?

With CONFIG_WERROR=n, LLVM 17.0.1 (the minimum the kernel supports)
and 18.1.8 fail with:

  ld.lld: error: vmlinux.a(arch/hexagon/kernel/head.o):
  (.init.text+0xd4): relocation R_HEX_B22_PCREL out of range: 2242552
  is not in [-2097152, 2097151]; references '__vmnewmap'

and the same for the second call to __vmnewmap and for the calls to
__vmsetvec and memset. I see it on v7.4-rc1, next-20261113,
hexagon-fixes (0304683b4c43) and v7.3.4; v6.18.63 (LTS) fails with
LLVM 17.0.1 only. With LLVM 19.1.7 to 23.1.3, v7.4-rc1 links.

The calls in stext go from .init.text to .text, across the rest of
.init.text and the per-CPU data. On v7.4-rc1 with LLVM 17.0.1 that is
2.14 MiB; without CONFIG_LOCK_STAT, whose per-CPU data lies in
between, it is 0.76 MiB. ld.lld before 19.1.5 checks R_HEX_B22_PCREL
against 2 MiB instead of 8 MiB, which llvm-project 64e3466fd09e fixed.

09df35bd9d9f does not apply to the trees above: its context has the
"r2 = #VM_TLB_INVALIDATE_TRUE" lines of your series. With its five
changes made by hand:

- allmodconfig links with LLVM 17.0.1 and 18.1.8 on all five trees,
  and allyesconfig of v7.4-rc1 with LLVM 18.1.8, which failed too;
- where v7.4-rc1 linked before (defconfig with LLVM 17.0.1 to 23.1.3,
  allmodconfig with LLVM 19.1.7 to 23.1.3), vmlinux differs only in
  the code of stext, in the address of one local label and in the
  build ID.

Those trees do not boot in QEMU, so I boot-tested your branch
(dc370baa041d, v7.3-rc1 plus 24 patches), with 3 MiB of test-only
padding at the end of head.S to make the extended calls span over
3 MiB: qemu_defconfig built with LLVM 17.0.1 and 23.1.3 boots to a
shell on a buildroot root filesystem under qualcomm/qemu hex-next with
-M virt,hvm=on. I have no hexagon hardware.

Rebased onto hexagon-fixes, 09df35bd9d9f applies to v7.3.4 and
v6.18.63 unchanged; I can send the rebased patch if that is easier.
If it helps:

Tested-by: Tzu-Ching Yang <shingekinocore@gmail.com>

Nathan, once the fix is merged, the ClangBuiltLinux CI could build
hexagon allmodconfig with LLVM 17 and 18 again (disabled in
continuous-integration2 d9d773a8859c).

Thanks,
Tzu-Ching

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

* Re: hexagon: allmodconfig does not link with LLVM 17 and 18
  2026-11-19  5:49 hexagon: allmodconfig does not link with LLVM 17 and 18 Tzu-Ching Yang
@ 2026-11-19 15:29 ` Brian Cain
  2026-11-19 19:51 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Cain @ 2026-11-19 15:29 UTC (permalink / raw)
  To: Tzu-Ching Yang, Brian Cain
  Cc: linux-hexagon, Nathan Chancellor, llvm, linux-kernel


On 11/18/2026 11:49 PM, Tzu-Ching Yang wrote:
> Hi Brian,
>
> hexagon allmodconfig does not link with LLVM 17 and 18, on mainline
> and on stable. Your hexagon-qemu-virt branch has the fix, 09df35bd9d9f
> ("hexagon: constant-extend head.S calls to out-of-file symbols");
> could it go to hexagon-fixes, with Cc: stable?
>
> With CONFIG_WERROR=n, LLVM 17.0.1 (the minimum the kernel supports)
> and 18.1.8 fail with:
>
>    ld.lld: error: vmlinux.a(arch/hexagon/kernel/head.o):
>    (.init.text+0xd4): relocation R_HEX_B22_PCREL out of range: 2242552
>    is not in [-2097152, 2097151]; references '__vmnewmap'
>
> and the same for the second call to __vmnewmap and for the calls to
> __vmsetvec and memset. I see it on v7.4-rc1, next-20261113,
> hexagon-fixes (0304683b4c43) and v7.3.4; v6.18.63 (LTS) fails with
> LLVM 17.0.1 only. With LLVM 19.1.7 to 23.1.3, v7.4-rc1 links.
>
> The calls in stext go from .init.text to .text, across the rest of
> .init.text and the per-CPU data. On v7.4-rc1 with LLVM 17.0.1 that is
> 2.14 MiB; without CONFIG_LOCK_STAT, whose per-CPU data lies in
> between, it is 0.76 MiB. ld.lld before 19.1.5 checks R_HEX_B22_PCREL
> against 2 MiB instead of 8 MiB, which llvm-project 64e3466fd09e fixed.
>
> 09df35bd9d9f does not apply to the trees above: its context has the
> "r2 = #VM_TLB_INVALIDATE_TRUE" lines of your series. With its five
> changes made by hand:
>
> - allmodconfig links with LLVM 17.0.1 and 18.1.8 on all five trees,
>    and allyesconfig of v7.4-rc1 with LLVM 18.1.8, which failed too;
> - where v7.4-rc1 linked before (defconfig with LLVM 17.0.1 to 23.1.3,
>    allmodconfig with LLVM 19.1.7 to 23.1.3), vmlinux differs only in
>    the code of stext, in the address of one local label and in the
>    build ID.
>
> Those trees do not boot in QEMU, so I boot-tested your branch
> (dc370baa041d, v7.3-rc1 plus 24 patches), with 3 MiB of test-only
> padding at the end of head.S to make the extended calls span over
> 3 MiB: qemu_defconfig built with LLVM 17.0.1 and 23.1.3 boots to a
> shell on a buildroot root filesystem under qualcomm/qemu hex-next with
> -M virt,hvm=on. I have no hexagon hardware.
>
> Rebased onto hexagon-fixes, 09df35bd9d9f applies to v7.3.4 and
> v6.18.63 unchanged; I can send the rebased patch if that is easier.

If you would do that, that would be great - thanks.


> If it helps:
>
> Tested-by: Tzu-Ching Yang <shingekinocore@gmail.com>
>
> Nathan, once the fix is merged, the ClangBuiltLinux CI could build
> hexagon allmodconfig with LLVM 17 and 18 again (disabled in
> continuous-integration2 d9d773a8859c).
>
> Thanks,
> Tzu-Ching

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

* Re: hexagon: allmodconfig does not link with LLVM 17 and 18
  2026-11-19  5:49 hexagon: allmodconfig does not link with LLVM 17 and 18 Tzu-Ching Yang
  2026-11-19 15:29 ` Brian Cain
@ 2026-11-19 19:51 ` Nathan Chancellor
  1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2026-11-19 19:51 UTC (permalink / raw)
  To: Tzu-Ching Yang; +Cc: Brian Cain, linux-hexagon, llvm, linux-kernel

On Thu, Nov 19, 2026 at 01:49:08PM +0800, Tzu-Ching Yang wrote:
> Nathan, once the fix is merged, the ClangBuiltLinux CI could build
> hexagon allmodconfig with LLVM 17 and 18 again (disabled in
> continuous-integration2 d9d773a8859c).

Thanks for the heads up. I probably won't re-enable them right away
since we are a little build resource limited right now.

-- 
Cheers,
Nathan

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

end of thread, other threads:[~2026-11-19 19:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  5:49 hexagon: allmodconfig does not link with LLVM 17 and 18 Tzu-Ching Yang
2026-11-19 15:29 ` Brian Cain
2026-11-19 19:51 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox