Re: Clang patch stacks for LTS kernels (v4.4 and v4.9) and status update

From: Sedat Dilek
Date: Tue May 22 2018 - 02:45:18 EST


On Sat, May 19, 2018 at 12:54 AM, Nick Desaulniers
<nick.desaulniers@xxxxxxxxx> wrote:
> Sedat,
> Thanks for the report. We have a fix ready in
> https://bugs.llvm.org/show_bug.cgi?id=37512. Can you report what
> version of clang you were using and if earlier versions of clang have
> this issue?
> Thanks,

Can you give some advices on how to implement
"attribute((no_stack_protector))" for Clang?

I looked on how this is done for GCC...

[ include/linux/compiler-gcc.h ]

#if GCC_VERSION >= 40400
#define __optimize(level) __attribute__((__optimize__(level)))
#define __nostackprotector __optimize("no-stack-protector")
#endif /* GCC_VERSION >= 40400 */

[ include/linux/compiler_types.h ]

#ifndef __nostackprotector
# define __nostackprotector
#endif

LLVM-bug #37512 says:

"GCC option for this is: attribute((optimize("no-stack-protector")))
and the equivalent clang syntax would be: attribute((no_stack_protector))"

So, there should be a define in "include/linux/compiler-clang.h" for this?

[ include/linux/compiler-clang.h ]

#define __nostackprotector attribute((no_stack_protector))

Looks that good to you?

- Sedat -