drm/amd/display: Explicitly set stack size to 4
PATCH 1/1 drm/amd/display: Explicitly set stack size to 4
In certain kernels using GCC 8.2, we get compilation errors saying:
-mpreferred-stack-boundary=3 is not between 4 and 12 Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles, even when SSE2 is enabled
--- drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++---- drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++---- 6 files changed, 25 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/Makefile +4 -4
@@ -26,7 +26,9 @@ # ifdef CONFIG_X86 -calcs_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64
@@ -40,12 +42,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -calcs_ccflags += -mpreferred-stack-boundary=4 -else calcs_ccflags += -msse2 endif endif
drivers/gpu/drm/amd/display/dc/dcn20/Makefile +4 -4
@@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d DCN20 += dcn20_dsc.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64
@@ -24,12 +26,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 endif endif
drivers/gpu/drm/amd/display/dc/dcn21/Makefile +4 -4
@@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ dcn21_hwseq.o dcn21_link_encoder.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64
@@ -20,12 +22,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 endif endif
drivers/gpu/drm/amd/display/dc/dcn30/Makefile +4 -4
@@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \ CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif endif -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2 endif
drivers/gpu/drm/amd/display/dc/dml/Makefile +5 -4
@@ -25,8 +25,11 @@ # It provides the general basic services required by other DAL # subcomponents. + ifdef CONFIG_X86 -dml_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64
@@ -40,12 +43,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dml_ccflags += -mpreferred-stack-boundary=4 -else dml_ccflags += -msse2 endif endif
drivers/gpu/drm/amd/display/dc/dsc/Makefile +4 -4
@@ -3,7 +3,9 @@ # Makefile for the 'dsc' sub-component of DAL. ifdef CONFIG_X86 -dsc_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64
@@ -17,12 +19,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dsc_ccflags += -mpreferred-stack-boundary=4 -else dsc_ccflags += -msse2 endif endif
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 7 lines · Kent Russell
In certain kernels using GCC 8.2, we get compilation errors saying:
-mpreferred-stack-boundary=3 is not between 4 and 12 Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles, even when SSE2 is enabledChange-Id Ic7c4637e2e521af2d0444d3b5886f710131c80caSigned-off-by Kent Russell <[email protected]>
Seems reasonable to me. I'd imagine we want this anyway since SIMD generally wants to be 16-byte aligned anyway and this code has FP in it.
Regards,
Nicholas Kazlauskas
Quoted 175 lines
--- drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++---- drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++---- 6 files changed, 25 insertions(+), 24 deletions(-)drivers/gpu/drm/amd/display/dc/calcs/Makefile +4
-4@@ -26,7 +26,9 @@ # ifdef CONFIG_X86 -calcs_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +42,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -calcs_ccflags += -mpreferred-stack-boundary=4 -else calcs_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn20/Makefile +4
-4@@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d DCN20 += dcn20_dsc.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -24,12 +26,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn21/Makefile +4
-4@@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ dcn21_hwseq.o dcn21_link_encoder.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -20,12 +22,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn30/Makefile +4
-4@@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \ CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif endif -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2 endifdrivers/gpu/drm/amd/display/dc/dml/Makefile +5
-4@@ -25,8 +25,11 @@ # It provides the general basic services required by other DAL # subcomponents. + ifdef CONFIG_X86 -dml_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +43,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dml_ccflags += -mpreferred-stack-boundary=4 -else dml_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dsc/Makefile +3
-1@@ -3,7 +3,9 @@ # Makefile for the 'dsc' sub-component of DAL. ifdef CONFIG_X86 -dsc_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -17,12 +19,10 @@ endif endif ifdef CONFIG_X86
drivers/gpu/drm/amd/display/dc/dsc/Makefile endif · line 28
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dsc/Makefile +1
-3-ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dsc_ccflags += -mpreferred-stack-boundary=4 -else dsc_ccflags += -msse2 endif endif
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Am 2020-07-21 um 11:38 a.m. schrieb Kent Russell:
Quoted 4 lines
In certain kernels using GCC 8.2, we get compilation errors saying:
-mpreferred-stack-boundary=3 is not between 4 and 12 Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles, even when SSE2 is enabled
As I understand it, -mpreferred-stack-boundary does not affect the stack size, but the alignment of the stack frame.
The GCC manpage explains that mixing different stack boundary settings can lead to errors when functions compiled with stack-boundary=3 call functions with stack-boundary=4. That sounds like setting a different stack boundary explicitly in only some parts of the code is probably a bad idea.
Quote from the gcc mangage:
Quoted 16 lines
Warning: When generating code for the x86-64 architecture with SSE
extensions disabled, -mpreferred-stack-boundary=3 can be used to
keep the stack boundary aligned to 8 byte boundary. Since x86-64
ABI require 16 byte stack alignment, this is ABI incompatible and
intended to be used in controlled environment where stack space is
important limitation. This option leads to wrong code when functions compiled with 16 byte stack alignment (such as functions
from a standard library) are called with misaligned stack. In this
case, SSE instructions may lead to misaligned memory access
Quoted 8 lines
traps.
In addition, variable arguments are handled incorrectly for 16 byte
aligned objects (including x87 long double and__int128), leading
to wrong results. You must build all modules with -mpreferred-stack-boundary=3, including any libraries. This includes the system libraries and startup modules.
Regards,
Felix
Quoted 177 lines
Change-Id Ic7c4637e2e521af2d0444d3b5886f710131c80caSigned-off-by Kent Russell <[email protected]>--- drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++---- drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++---- 6 files changed, 25 insertions(+), 24 deletions(-)drivers/gpu/drm/amd/display/dc/calcs/Makefile +4
-4@@ -26,7 +26,9 @@ # ifdef CONFIG_X86 -calcs_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +42,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -calcs_ccflags += -mpreferred-stack-boundary=4 -else calcs_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn20/Makefile +4
-4@@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d DCN20 += dcn20_dsc.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -24,12 +26,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn21/Makefile +4
-4@@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ dcn21_hwseq.o dcn21_link_encoder.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -20,12 +22,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn30/Makefile +4
-4@@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \ CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif endif -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2 endifdrivers/gpu/drm/amd/display/dc/dml/Makefile +5
-4@@ -25,8 +25,11 @@ # It provides the general basic services required by other DAL # subcomponents. + ifdef CONFIG_X86 -dml_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +43,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dml_ccflags += -mpreferred-stack-boundary=4 -else dml_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dsc/Makefile +3
-1@@ -3,7 +3,9 @@ # Makefile for the 'dsc' sub-component of DAL. ifdef CONFIG_X86 -dsc_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -17,12 +19,10 @@ endif endif ifdef CONFIG_X86
drivers/gpu/drm/amd/display/dc/dsc/Makefile endif · line 28
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dsc/Makefile +1
-3-ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dsc_ccflags += -mpreferred-stack-boundary=4 -else dsc_ccflags += -msse2 endif endif
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 42 lines · Felix Kuehling
Am 2020-07-21 um 11:38 a.m. schrieb Kent Russell:
Quoted 4 lines
In certain kernels using GCC 8.2, we get compilation errors saying:
-mpreferred-stack-boundary=3 is not between 4 and 12 Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles, even when SSE2 is enabledAs I understand it, -mpreferred-stack-boundary does not affect the stack size, but the alignment of the stack frame.
The GCC manpage explains that mixing different stack boundary settings can lead to errors when functions compiled with stack-boundary=3 call functions with stack-boundary=4. That sounds like setting a different stack boundary explicitly in only some parts of the code is probably a bad idea.
Quote from the gcc mangage:
Quoted 16 lines
Warning: When generating code for the x86-64 architecture
with SSE
extensions disabled, -mpreferred-stack-boundary=3 can be
used to
keep the stack boundary aligned to 8 byte boundary. Since
x86-64
ABI require 16 byte stack alignment, this is ABI
incompatible and
intended to be used in controlled environment where stack
space is
important limitation. This option leads to wrong code when functions compiled with 16 byte stack alignment (such as
functions
from a standard library) are called with misaligned stack.
In this
case, SSE instructions may lead to misaligned memory accessQuoted 8 lines
traps.
In addition, variable arguments are handled incorrectly for
16 byte
aligned objects (including x87 long double and__int128),
leading
to wrong results. You must build all modules with -mpreferred-stack-boundary=3, including any libraries. This includes the system libraries and startup modules.
Quoted 2 lines
Regards,
Felix
Oh right, I remember that this issue was brought up before.
https://github.com/ClangBuiltLinux/linux/issues/735
I don't think we want to be mixing alignment then. Maybe let's hold off on this change for now and figure out if we still need this flag set at all for GCC 8.2 onward.
like
#ifndef GCC82
ccflags += -mpreferred-stack-boundary=3
#endif
Regards,
Nicholas Kazlauskas
Quoted 178 lines
Quoted 178 lines
Change-Id Ic7c4637e2e521af2d0444d3b5886f710131c80caSigned-off-by Kent Russell <[email protected]>--- drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++---- drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++---- drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++---- 6 files changed, 25 insertions(+), 24 deletions(-)drivers/gpu/drm/amd/display/dc/calcs/Makefile +4
-4@@ -26,7 +26,9 @@ # ifdef CONFIG_X86 -calcs_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +42,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -calcs_ccflags += -mpreferred-stack-boundary=4 -else calcs_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn20/Makefile +4
-4@@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d DCN20 += dcn20_dsc.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -24,12 +26,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn21/Makefile +4
-4@@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ dcn21_hwseq.o dcn21_link_encoder.o ifdef CONFIG_X86 -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -20,12 +22,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dcn30/Makefile +4
-4@@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \ CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4 ifdef CONFIG_CC_IS_GCC ifeq ($(call cc-ifversion, -lt, 0701, y), y) IS_OLD_GCC = 1 endif endif -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4 -else CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2 endifdrivers/gpu/drm/amd/display/dc/dml/Makefile +5
-4@@ -25,8 +25,11 @@ # It provides the general basic services required by other DAL # subcomponents. + ifdef CONFIG_X86 -dml_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -40,12 +43,10 @@ endif endif ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dml_ccflags += -mpreferred-stack-boundary=4 -else dml_ccflags += -msse2 endif endifdrivers/gpu/drm/amd/display/dc/dsc/Makefile +3
-1@@ -3,7 +3,9 @@ # Makefile for the 'dsc' sub-component of DAL. ifdef CONFIG_X86 -dsc_ccflags := -mhard-float -msse +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it +# to 4, even if we enable SSE2 +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4 endif ifdef CONFIG_PPC64@@ -17,12 +19,10 @@ endif endif
Quoted 16 lines
drivers/gpu/drm/amd/display/dc/dsc/Makefile endif · line 28
Quoted 11 lines
drivers/gpu/drm/amd/display/dc/dsc/Makefile +1
-3ifdef CONFIG_X86 -ifdef IS_OLD_GCC +ifndef IS_OLD_GCC # Stack alignment mismatch, proceed with caution. # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # (8B stack alignment). -dsc_ccflags += -mpreferred-stack-boundary=4 -else dsc_ccflags += -msse2 endif endif_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx