Skip to contentSkip to conversation

hexagon: allmodconfig does not link with LLVM 17 and 18

DISCUSSION Tzu-Ching Yang 3 participants 3 messages Nov 19 Qualcomm hexagon architecture

lore
Share & tools
lore

Tzu-Ching Yang

author Tested-by
#0 lore raw

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:

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

maintainer
#1 lore raw
Quoted 43 lines · Tzu-Ching Yang

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.

Quoted 2 lines

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.

Quoted 10 lines

If it helps:

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

#2 lore raw
In reply to Tzu-Ching Yang
Quoted 3 lines · Tzu-Ching Yang

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.

Signature · 2 lines
Cheers,
Nathan