From 287280f88220244fec3834b0016e2a778dd66cad Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Tue, 5 Dec 2023 09:17:54 +0100 Subject: [PATCH] makefiles/arch/riscv.inc.mk: Always provide TARGET_ARCH_LLVM This fixes issues with `make compile-commands`, as this by default generates clangd/LLVM compatible flags. Without `TARGET_ARCH_LLVM` exported, this will fall back to `TARGET_ARCH`, which is different for LLVM and GCC. --- makefiles/arch/riscv.inc.mk | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/makefiles/arch/riscv.inc.mk b/makefiles/arch/riscv.inc.mk index b8fc8da19a..ebe62eddbd 100644 --- a/makefiles/arch/riscv.inc.mk +++ b/makefiles/arch/riscv.inc.mk @@ -66,11 +66,10 @@ ifeq (1,$(GCC_DEFAULTS_TO_NEW_RISCV_ISA)) CFLAGS_CPU += -misa-spec=2.2 endif -ifeq ($(TOOLCHAIN),llvm) - # Always use riscv32-none-elf as target triple for clang, as some - # autodetected gcc target triples are incompatible with clang - TARGET_ARCH_LLVM := riscv32-none-elf -else +# Always use riscv32-none-elf as target triple for clang, as some +# autodetected gcc target triples are incompatible with clang +TARGET_ARCH_LLVM := riscv32-none-elf +ifneq ($(TOOLCHAIN),llvm) CFLAGS_CPU += -mcmodel=medlow -msmall-data-limit=8 # We cannot invoke the compiler on the host system if build in docker. # Instead, hard-code the required flags for the docker toolchain here