linux-stable/arch/hexagon
Nathan Chancellor aef25be35d hexagon: Disable constant extender optimization for LLVM prior to 19.1.0
The Hexagon-specific constant extender optimization in LLVM may crash on
Linux kernel code [1], such as fs/bcache/btree_io.c after
commit 32ed4a620c ("bcachefs: Btree path tracepoints") in 6.12:

  clang: llvm/lib/Target/Hexagon/HexagonConstExtenders.cpp:745: bool (anonymous namespace)::HexagonConstExtenders::ExtRoot::operator<(const HCE::ExtRoot &) const: Assertion `ThisB->getParent() == OtherB->getParent()' failed.
  Stack dump:
  0.      Program arguments: clang --target=hexagon-linux-musl ... fs/bcachefs/btree_io.c
  1.      <eof> parser at end of file
  2.      Code generation
  3.      Running pass 'Function Pass Manager' on module 'fs/bcachefs/btree_io.c'.
  4.      Running pass 'Hexagon constant-extender optimization' on function '@__btree_node_lock_nopath'

Without assertions enabled, there is just a hang during compilation.

This has been resolved in LLVM main (20.0.0) [2] and backported to LLVM
19.1.0 but the kernel supports LLVM 13.0.1 and newer, so disable the
constant expander optimization using the '-mllvm' option when using a
toolchain that is not fixed.

Cc: stable@vger.kernel.org
Link: https://github.com/llvm/llvm-project/issues/99714 [1]
Link: 68df06a0b2 [2]
Link: 2ab8d93061 [3]
Reviewed-by: Brian Cain <bcain@quicinc.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-17 14:07:53 -08:00
..
configs treewide: drop CONFIG_EMBEDDED 2023-08-21 13:46:25 -07:00
include - The series "resource: A couple of cleanups" from Andy Shevchenko 2024-11-25 16:09:48 -08:00
kernel hexagon: vdso: Fix build failure 2024-09-23 08:17:50 -07:00
lib hexagon: simplify asm/io.h for !HAS_IOPORT 2024-10-28 21:44:29 +00:00
mm hexagon: vm_tlb: include asm/tlbflush.h for prototypes 2023-12-10 17:21:35 -08:00
Kbuild hexagon: move core-y in arch/hexagon/Makefile to arch/hexagon/Kbuild 2021-05-26 23:11:47 +09:00
Kconfig hexagon: simplify asm/io.h for !HAS_IOPORT 2024-10-28 21:44:29 +00:00
Kconfig.debug treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 2024-12-17 14:07:53 -08:00