Skip to contentSkip to conversation

pmdomain: airoha: Fix compilation error with Clang-20 and Thumb2 mode

PATCH In review Christian Marangi 2 participants 2 messages Jan 20, 2025 – Jan 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pmdomain: airoha: Fix compilation error with Clang-20 and Thumb2 mode

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.

Fixes 82e703dd438b ("pmdomain: airoha: Add Airoha CPU PM Domain support")
---
 drivers/pmdomain/mediatek/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pmdomain/mediatek/Makefile +7 -0
index 0f6edce9239b..18ba92e3c418 100644
@@ -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
Signature · 1 line
2.47.1
#1 lore raw
Quoted 9 lines · Christian Marangi

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.

Quoted 5 lines
Fixes 82e703dd438b ("pmdomain: airoha: Add Airoha CPU PM Domain support")

Applied for next, thanks!

Kind regards
Uffe

Quoted 22 lines
---
 drivers/pmdomain/mediatek/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pmdomain/mediatek/Makefile +7 -1
index 0f6edce9239b..18ba92e3c418 100644
@@ -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
--

2.47.1