sync_synchronize.S 973 B

1234567891011121314151617181920212223242526272829303132333435
  1. //===-- sync_synchronize - Implement memory barrier * ----------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #include "../assembly.h"
  9. // When compiling a use of the gcc built-in __sync_synchronize() in thumb1 mode
  10. // the compiler may emit a call to __sync_synchronize.
  11. // On Darwin the implementation jumps to an OS supplied function named
  12. // OSMemoryBarrier
  13. .text
  14. .syntax unified
  15. #if __APPLE__
  16. .p2align 2
  17. DEFINE_COMPILERRT_PRIVATE_FUNCTION(__sync_synchronize)
  18. stmfd sp!, {r7, lr}
  19. add r7, sp, #0
  20. bl _OSMemoryBarrier
  21. ldmfd sp!, {r7, pc}
  22. END_COMPILERRT_FUNCTION(__sync_synchronize)
  23. // tell linker it can break up file at label boundaries
  24. .subsections_via_symbols
  25. #endif
  26. NO_EXEC_STACK_DIRECTIVE