diff --git a/Makefile b/Makefile index 8669a87f85348..b880296b601ec 100644 --- a/Makefile +++ b/Makefile @@ -488,7 +488,9 @@ ifeq ($(shell $(srctree)/scripts/clang-android.sh $(CC) $(CLANG_FLAGS)), y) $(error "Clang with Android --target detected. Did you specify CLANG_TRIPLE?") endif GCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit)) -CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE)) # In Clang version 12 and up, there has been a change in Clang's handling of cross-compiling + # and since then, when specifying a Clang-based toolchain, it will output an error which states that "-EL" + # is unsupported. fix from kdrag0n/proton-clang readme GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) @@ -686,6 +688,15 @@ else KBUILD_CFLAGS += -O2 endif +# -fstack-protector compatibility when building with Clang-based toolchains. fix from kdrag0n/proton-clang readme +# May have some potential performance gains for dedicated architecture optimization flags. +ifeq ($(cc-name),gcc) +KBUILD_CFLAGS += -mcpu=cortex-a75.cortex-a55 -mtune=cortex-a75.cortex-a55 +endif +ifeq ($(cc-name),clang) +KBUILD_CFLAGS += -mcpu=cortex-a55 -mtune=cortex-a55 +endif + # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)