Re: [PATCH 2/2] amdgpu/dc/dml: Support clang option for stack alignment

From: Guenter Roeck
Date: Wed Feb 07 2018 - 20:34:50 EST


On Wed, Feb 7, 2018 at 5:21 PM, Matthias Kaehlcke <mka@xxxxxxxxxxxx> wrote:
> DML uses the compiler option -mpreferred-stack-boundary=4 to configure
> a stack alignment of 16 bytes. Clang uses the option -mstack-alignment
> instead, which expects as parameter the alignment in bytes, and not a
> power of two like -mpreferred-stack-boundary.
>
> Probe for both compiler options and use the correct one, similar to
> what is done in arch/x86/Makefile.
>
> Reported-by: Guenter Roeck <groeck@xxxxxxxxxxxx>
> Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
> ---
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index b8cadf833e71..740975931d21 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -24,7 +24,13 @@
> # It provides the general basic services required by other DAL
> # subcomponents.
>
> -subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4
> +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
> + cc_stack_align=-mpreferred-stack-boundary=4
> +else ifneq ($(call cc-option, -mstack-alignment=16),)
> + cc_stack_align := -mstack-alignment=16
> +endif
> +
Any reason for using both = and := ?

> +subdir-ccflags-y += -mhard-float -msse $(cc_stack_align)
>
> DML = display_mode_lib.o display_rq_dlg_calc.o \
> display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
> --
> 2.16.0.rc1.238.g530d649a79-goog
>