]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pmdomain: airoha: Fix compilation error with Clang-20 and Thumb2 mode
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 20 Jan 2025 15:38:09 +0000 (16:38 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 21 Jan 2025 09:45:24 +0000 (10:45 +0100)
The use of R7 in the SMCCC conflicts with the compiler's use of R7 as a frame
pointer in Thumb2 mode, which is forcibly enabled by Clang when profiling
hooks are inserted via the -pg switch.

This is a known issue and similar driver workaround this with a Makefile
ifdef. Exact workaround are applied in
drivers/firmware/arm_scmi/transports/Makefile and other similar driver.

Suggested-by: Sudeep Holla <sudeep.holla@arm.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501201840.XmpHXpQ4-lkp@intel.com/
Fixes: 82e703dd438b ("pmdomain: airoha: Add Airoha CPU PM Domain support")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20250120153817.11807-1-ansuelsmth@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/mediatek/Makefile

index 0f6edce9239b41b82d7cf353ceaacd7ff8fac1c8..18ba92e3c418154e1d428dbc6b59b97b26056d98 100644 (file)
@@ -2,3 +2,10 @@
 obj-$(CONFIG_MTK_SCPSYS)               += mtk-scpsys.o
 obj-$(CONFIG_MTK_SCPSYS_PM_DOMAINS)    += mtk-pm-domains.o
 obj-$(CONFIG_AIROHA_CPU_PM_DOMAIN)     += airoha-cpu-pmdomain.o
+
+ifeq ($(CONFIG_THUMB2_KERNEL)$(CONFIG_CC_IS_CLANG),yy)
+# The use of R7 in the SMCCC conflicts with the compiler's use of R7 as a frame
+# pointer in Thumb2 mode, which is forcibly enabled by Clang when profiling
+# hooks are inserted via the -pg switch.
+CFLAGS_REMOVE_airoha-cpu-pmdomain.o += $(CC_FLAGS_FTRACE)
+endif