Fix compilation of server.cc on hpux.
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_common_interceptors_vfork_aarch64.inc.S
blob72e482754b62b2b21bfd9af03c67056af4509411
1 #if defined(__aarch64__) && defined(__linux__)
3 #include "sanitizer_common/sanitizer_asm.h"
4 #include "builtins/assembly.h"
6 ASM_HIDDEN(COMMON_INTERCEPTOR_SPILL_AREA)
8 .comm _ZN14__interception10real_vforkE,8,8
9 .globl ASM_WRAPPER_NAME(vfork)
10 ASM_TYPE_FUNCTION(ASM_WRAPPER_NAME(vfork))
11 ASM_WRAPPER_NAME(vfork):
12         // Save x30 in the off-stack spill area.
13         hint    #25 // paciasp
14         stp     xzr, x30, [sp, #-16]!
15         bl      COMMON_INTERCEPTOR_SPILL_AREA
16         ldp     xzr, x30, [sp], 16
17         str     x30, [x0]
19         // Call real vfork. This may return twice. User code that runs between the first and the second return
20         // may clobber the stack frame of the interceptor; that's why it does not have a frame.
21         adrp    x0, _ZN14__interception10real_vforkE
22         ldr     x0, [x0, :lo12:_ZN14__interception10real_vforkE]
23         blr     x0
25         stp     x0, xzr, [sp, #-16]!
26         cmp     x0, #0
27         b.eq   .L_exit
29         // x0 != 0 => parent process. Clear stack shadow.
30         add    x0, sp, #16
31         bl     COMMON_INTERCEPTOR_HANDLE_VFORK
33 .L_exit:
34         // Restore x30.
35         bl     COMMON_INTERCEPTOR_SPILL_AREA
36         ldr    x30, [x0]
37         ldp    x0, xzr, [sp], 16
38         hint   #29 // autiasp
40         ret
41 ASM_SIZE(vfork)
43 .weak vfork
44 .set vfork, ASM_WRAPPER_NAME(vfork)
46 GNU_PROPERTY_BTI_PAC
48 #endif