Re: [PATCH] drm/amd/display: Support clang option for stack alignment
From: Arnd Bergmann
Date: Fri Jul 12 2019 - 16:30:35 EST
On Fri, Jul 12, 2019 at 8:49 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
>
> On Fri, Jul 12, 2019 at 2:37 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >
> > As previously fixed for dml in commit 4769278e5c7f ("amdgpu/dc/dml:
> > Support clang option for stack alignment") and calcs in commit
> > cc32ad8f559c ("amdgpu/dc/calcs: Support clang option for stack
> > alignment"), dcn20 uses an option that is not available with clang:
> >
> > clang: error: unknown argument: '-mpreferred-stack-boundary=4'
> > scripts/Makefile.build:281: recipe for target 'drivers/gpu/drm/amd/amdgpu/../display/dc/dcn20/dcn20_resource.o' failed
> >
> > Use the same trick that we have in the other two files.
>
> Maybe time for a macro in Kbuild.include or some such, if we see this
> pattern being repeated?
I'm not actually convinced that the argument does anything useful
at all, if the kernel stack is normally not 16-byte aligned
when we enter the driver, and it clearly is not needed if the stack
is already aligned.
Unless any code calling into the portions that want the alignment
manually aligns the kernel stack pointer, we could just as well
leave it out. The git history does not explain why it was added in the
first place though, so I really have no idea.
I see in the architecture makefiles that i386 kernels are built with
the same flag globally, but other architectures (including x86_64)
use the default stack alignment, which may be different.
Arnd