This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA][PATCH] Improve initial probe for noreturn functions for x86 target


On 11/06/2017 06:39 AM, Rainer Orth wrote:
> Uros Bizjak <ubizjak@gmail.com> writes:
> 
>>>             * config/i386/i386.c (ix86_emit_restore_reg_using_pop):
>> Prototype.
>>>             (ix86_adjust_stack_and_probe_stack_clash): Use a push/pop
>> sequence
>>>             to probe at the start of a noreturn function.
>>>
>>>             * gcc.target/i386/stack-check-12.c: New test
>>
>> OK.
> [...]
>>> diff --git a/gcc/testsuite/gcc.target/i386/stack-check-12.c
>> b/gcc/testsuite/gcc.target/i386/stack-check-12.c
>>> new file mode 100644
>>> index 0000000..cb69bb0
>>> --- /dev/null
>>> +++ b/gcc/testsuite/gcc.target/i386/stack-check-12.c
>>> @@ -0,0 +1,19 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O2 -fstack-clash-protection -mtune=generic" } */
>>> +/* { dg-require-effective-target supports_stack_clash_protection } */
>>> +
>>> +__attribute__ ((noreturn)) void exit (int);
>>> +
>>> +__attribute__ ((noreturn)) void
>>> +f (void)
>>> +{
>>> +  asm volatile ("nop" ::: "edi");
>>> +  exit (1);
>>> +}
>>> +
>>> +/* { dg-final { scan-assembler-not "or\[ql\]" } } */
>>> +/* { dg-final { scan-assembler "pushl  %esi" { target ia32 } } } */
>>> +/* { dg-final { scan-assembler "popl   %esi" { target ia32 } } }*/
>>> +/* { dg-final { scan-assembler "pushq  %rax" { target { ! ia32 } } } } */
>>> +/* { dg-final { scan-assembler "popq   %rax" { target { ! ia32 } } } }*/
>>> +
>>>
> 
> The new test FAILs on 64-bit Solaris/x86 which defaults to
> -fno-omit-frame-pointer:
> 
> FAIL: gcc.target/i386/stack-check-12.c scan-assembler popq\\t%rax
> FAIL: gcc.target/i386/stack-check-12.c scan-assembler pushq\\t%rax
> 
> The assembler output boils down to
[ ... ]
THanks.  I think just adding an explicit -fomit-frame-pointer is
sufficient to address this problem.  I'll take care of it.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]