drm/amd: Guard IS_OLD_GCC assignment with CONFIG_CC_IS_GCC
Subsystems (3)
PATCH 1/1 drm/amd: Guard IS_OLD_GCC assignment with CONFIG_CC_IS_GCC
cc-ifversion only works for GCC, as clang pretends to be GCC 4.2.1 for glibc compatibility, which means IS_OLD_GCC will get set and unsupported flags will be passed to clang when building certain code within the DCN files:
clang-14: error: unknown argument: '-mpreferred-stack-boundary=4'
make[5]: *** [scripts/Makefile.build:277: drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_resource.o] Error 1
Guard the call to cc-ifversion with CONFIG_CC_IS_GCC so that everything continues to work properly. See commit 00db297106e8 ("drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+") for more context.
--- drivers/gpu/drm/amd/display/dc/dcn201/Makefile | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn201/Makefile +2 -0
@@ -14,9 +14,11 @@ ifdef CONFIG_PPC64 CFLAGS_$(AMDDALPATH)/dc/dcn201/dcn201_resource.o := -mhard-float -maltivec endif +ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif +endif ifdef CONFIG_X86 ifdef IS_OLD_GCC
base-commit: b47b99e30cca8906753c83205e8c6179045dd725
Signature · 1 line
2.33.0.591.gddb1055343
Quoted 9 lines · Nathan Chancellor
cc-ifversion only works for GCC, as clang pretends to be GCC 4.2.1 for glibc compatibility, which means
IS_OLD_GCCwill get set and unsupported flags will be passed to clang when building certain code within the DCN files:clang-14: error: unknown argument: '-mpreferred-stack-boundary=4'
make[5]: *** [scripts/Makefile.build:277:drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_resource.o] Error 1
Quoted 7 lines
Guard the call to cc-ifversion with
CONFIG_CC_IS_GCCso that everything continues to work properly. See commit00db297106e8("drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+") for more context.Fixes ff7e396f822f ("drm/amd/display: add cyan_skillfish display support")Signed-off-by Nathan Chancellor <[email protected]>
Thanks for the patch!
$ grep -rn "ifdef IS_OLD_GCC" drivers/gpu/drm/amd/display/dc/ | wc -l 11
It's probably time to put this pattern in a Makefile under scripts/ and include it in all of these Makefiles. Anything to minimize the amount of code that has to be carried forward to new subdirs.
Quoted 25 lines
--- drivers/gpu/drm/amd/display/dc/dcn201/Makefile | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/display/dc/dcn201/Makefile +2
-0@@ -14,9 +14,11 @@ ifdef CONFIG_PPC64 CFLAGS_$(AMDDALPATH)/dc/dcn201/dcn201_resource.o := -mhard-float -maltivec endif +ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif +endif ifdef CONFIG_X86 ifdef IS_OLD_GCCbase-commit:
b47b99e30cca8906753c83205e8c6179045dd725--
2.33.0.591.gddb1055343
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 9 lines · Nathan Chancellor
cc-ifversion only works for GCC, as clang pretends to be GCC 4.2.1 for glibc compatibility, which means
IS_OLD_GCCwill get set and unsupported flags will be passed to clang when building certain code within the DCN files:clang-14: error: unknown argument: '-mpreferred-stack-boundary=4'
make[5]: *** [scripts/Makefile.build:277:drivers/gpu/drm/amd/amdgpu/../display/dc/dcn201/dcn201_resource.o] Error 1
Quoted 7 lines
Guard the call to cc-ifversion with
CONFIG_CC_IS_GCCso that everything continues to work properly. See commit00db297106e8("drm/amdgpu: fix stack alignment ABI mismatch for GCC 7.1+") for more context.Fixes ff7e396f822f ("drm/amd/display: add cyan_skillfish display support")Signed-off-by Nathan Chancellor <[email protected]>
Harry beat you to the punch by a little bit.
Thanks!
Alex
Quoted 25 lines
--- drivers/gpu/drm/amd/display/dc/dcn201/Makefile | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/display/dc/dcn201/Makefile +2
-0@@ -14,9 +14,11 @@ ifdef CONFIG_PPC64 CFLAGS_$(AMDDALPATH)/dc/dcn201/dcn201_resource.o := -mhard-float -maltivec endif +ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif +endif ifdef CONFIG_X86 ifdef IS_OLD_GCCbase-commit:
b47b99e30cca8906753c83205e8c6179045dd725--
2.33.0.591.gddb1055343