mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-08-22 00:42:01 +02:00

commitaef25be35d
upstream. The Hexagon-specific constant extender optimization in LLVM may crash on Linux kernel code [1], such as fs/bcache/btree_io.c after commit32ed4a620c
("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1.3 KiB
1.3 KiB
SPDX-License-Identifier: GPL-2.0
Makefile for the Hexagon arch
KBUILD_DEFCONFIG = comet_defconfig
Do not use GP-relative jumps
KBUILD_CFLAGS += -G0 LDFLAGS_vmlinux += -G0
Do not use single-byte enums; these will overflow.
KBUILD_CFLAGS += -fno-short-enums
We must use long-calls:
KBUILD_CFLAGS += -mlong-calls
Modules must use either long-calls, or use pic/plt.
Use long-calls for now, it's easier. And faster.
KBUILD_CFLAGS_MODULE += -fPIC
KBUILD_LDFLAGS_MODULE += -shared
KBUILD_CFLAGS_MODULE += -mlong-calls
cflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) aflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION}) ldflags-y += $(call cc-option,-mv${CONFIG_HEXAGON_ARCH_VERSION})
KBUILD_CFLAGS += $(cflags-y) KBUILD_AFLAGS += $(aflags-y) KBUILD_LDFLAGS += $(ldflags-y)
Thread-info register will be r19. This value is not configureable;
it is hard-coded in several files.
TIR_NAME := r19 KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__ KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
Disable HexagonConstExtenders pass for LLVM versions prior to 19.1.0
https://github.com/llvm/llvm-project/issues/99714
ifneq ($(call clang-min-version, 190100),y) KBUILD_CFLAGS += -mllvm -hexagon-cext=false endif