This patch is for linux-5.10.y only. It is functionally equivalent to
upstream commit 7db038d9790e ("drm/amd/display: Do not add
'-mhard-float' to dml_ccflags for clang"), which was created after all
files that require '-mhard-float' were moved under the dml folder. In
linux-5.10.y, which does not contain upstream commits
b4bab46400a0 ("drm/amd/display: move calcs folder into DML")
27e01f10d183 ("drm/amd/display: move FPU associated DSC code to DML folder")
40b31e5355ba ("drm/amd/display: Remove FPU flags from DCN30 Makefile")
clang-21 or newer errors with
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_math.o] Error 1
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calcs.o] Error 1
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dcn_calc_auto.o] Error 1
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/dsc/rc_calc.o] Error 1
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_optc.o] Error 1
clang: error: unsupported option '-mhard-float' for target
'x86_64-pc-linux-gnu'
make[6]: *** [scripts/Makefile.build:286:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn30/dcn30_resource.o] Error 1
Apply a functionally equivalent change to prevent adding '-mhard-float'
with clang for these files.
Closes: https://github.com/ClangBuiltLinux/linux/issues/2156
Signed-off-by: Nathan Chancellor <[email protected]>
---
Hi stable folks,
The ChromeOS folks raised an issue due to build failures in linux-5.10.y
when building with clang-21 or newer:
https://github.com/ClangBuiltLinux/linux/issues/2156
I thought I previously addressed this in all stable trees:
https://lore.kernel.org/20250604233141.GA2374479@ax162/
But our build coverage in 5.10 missed these files because allmodconfig
enables KCOV, which was incompatible with these files until upstream
commit 3876a8b5e241 ("drm/amd/display: Enable building new display
engine with KCOV enabled").
This change addresses the remaining errors in a functionally equivalent
manner as my original upstream commit 7db038d9790e ("drm/amd/display: Do
not add '-mhard-float' to dml_ccflags for clang"), similar to what I did
before in 5.10 commit 0c3939b00253 ("drm/amd/display: Do not add
'-mhard-float' to dcn2{1,0}_resource.o for clang"). There is technically
an upstream change that addresses the dcn30 error but it was done after
aarch64 support was dropped from the new display engine code, so I
preferred to do this to minimize potential regressions.
If there are any issues, please let me know.
---
drivers/gpu/drm/amd/display/dc/calcs/Makefile | 3 ++-
drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 4 ++--
drivers/gpu/drm/amd/display/dc/dsc/Makefile | 3 ++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
index cb7c37ef8735..1b3e3926b706 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
@@ -26,7 +26,8 @@
#
ifdef CONFIG_X86
-calcs_ccflags := -mhard-float -msse
+calcs_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
+calcs_ccflags := $(calcs_ccflags-y) -msse
endif
ifdef CONFIG_PPC64
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
index a71c0f298380..52d5826b2970 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
@@ -32,8 +32,8 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o
dcn30_optc.o \
ifdef CONFIG_X86
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := $(if
$(CONFIG_CC_IS_GCC),-mhard-float) -msse
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := $(if
$(CONFIG_CC_IS_GCC),-mhard-float) -msse
endif
ifdef CONFIG_PPC64
diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
index 6207809f293b..4fc6d9c32d16 100644
--- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
@@ -3,7 +3,8 @@
# Makefile for the 'dsc' sub-component of DAL.
ifdef CONFIG_X86
-dsc_ccflags := -mhard-float -msse
+dsc_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
+dsc_ccflags := $(dsc_ccflags-y) -msse
endif
ifdef CONFIG_PPC64
---
base-commit: aed5c3b77cd53ba74f66767b03bfb9177662af4b
change-id: 20260406-5-10-clang-amdgpu-hard-float-errors-44a87f1a7768
Best regards,
--
Nathan Chancellor <[email protected]>