lkml.org 
[lkml]   [2018]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [clang] stack protector and f1f029c7bf
On Fri, May 25, 2018 at 10:35 AM Tom Stellard <tstellar@redhat.com> wrote:
> On 05/25/2018 10:31 AM, Nick Desaulniers wrote:
> > On Fri, May 25, 2018 at 9:53 AM <hpa@zytor.com> wrote:
> >> On May 25, 2018 9:46:42 AM PDT, Nick Desaulniers <
ndesaulniers@google.com>
> > wrote:
> >>> On Fri, May 25, 2018 at 9:33 AM <hpa@zytor.com> wrote:
> >>>> On May 25, 2018 9:27:40 AM PDT, Nick Desaulniers
> >>> <ndesaulniers@google.com> wrote:
> >>> When you say
> >>>
> >>>> It still should be available as as inline, however, but now "extern
> >>> inline".
> >>>
> >>> Am I understanding correctly that native_save_fl should be inlined
into
> >>> all
> >>> call sites (modulo the problematic pv_irq_ops.save_fl case)? Because
> >>> for
> >>> these two assembly implementations, it's not, but maybe there's
> >>> something
> >>> missing in my implementation?
> >
> >> Yes, that's what "extern inline" means. Maybe it needs a must inline
> > annotation, but that's really messed up.
> >

> What about doing something like suggested here:
> https://bugs.llvm.org/show_bug.cgi?id=37512#c17

> This would keep the definition in C and make it easier for compilers
> to inline.

The GCC docs for __attribute__((naked)) seem to imply this is a machine
specific constraint (of which x86 is not listed):
https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html

But let's try with source:
https://godbolt.org/g/aJ4gZB

Clang errors:
<source>:3:3: error: non-ASM statement in naked function is not supported
unsigned long flags;
^

Is it valid to use assembly to place the results in %rax and mark the c
function somehow?

gcc doesn't support this attribute until 4.9 (but we can add a feature test
for attributes with gcc (unlike builtins)), but warns that:

warning: ‘naked’ attribute directive ignored [-Wattributes]

gcc 8.1 and trunk inserts a `ud2` instruction (what?!) (let me see if I can
repro outside of godbolt, and will file a bug report).
--
Thanks,
~Nick Desaulniers

\
 
 \ /
  Last update: 2018-05-25 19:50    [W:0.099 / U:0.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site