(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
shadow_call_stack_3.c
       1  /* Testing shadow call stack.  */
       2  /* scs_push: str x30, [x18], #8 */
       3  /* scs_pop: ldr x30, [x18, #-8]! */
       4  /* { dg-do compile } */
       5  /* { dg-options "-O2 -fsanitize=shadow-call-stack -ffixed-x18 -fno-exceptions" } */
       6  
       7  int foo (int);
       8  
       9  /* function not use x30.  */
      10  int func1 (void)
      11  {
      12    return 0;
      13  }
      14  
      15  /* function use x30.  */
      16  int func2 (void)
      17  {
      18    /* scs push */
      19    asm volatile ("":::"x30");
      20  
      21    return 0;
      22    /* scs pop */
      23  }
      24  
      25  /* sibcall.  */
      26  int func3 (int a, int b)
      27  {
      28    /* scs push */
      29    asm volatile ("":::"x30");
      30  
      31    return foo (a+b);
      32    /* scs pop */
      33  }
      34  
      35  /* eh_return.  */
      36  int func4 (long offset, void *handler)
      37  {
      38    /* Do not emit scs push/pop */
      39    asm volatile ("":::"x30");
      40  
      41    __builtin_eh_return (offset, handler);
      42  }
      43  
      44  /* { dg-final { scan-assembler-times {str\tx30, \[x18\], #?8} 2 } } */
      45  /* { dg-final { scan-assembler-times {ldr\tx30, \[x18, #?-8\]!} 2 } } */