From debb9010459d7523bf9e316c24225d90a5045d77 Mon Sep 17 00:00:00 2001 From: Nick Kledzik Date: Tue, 2 Feb 2010 21:34:04 +0000 Subject: [PATCH] add __sync_synchronize. Needed by compiler when emitting thumb1 with -fno-builtin llvm-svn: 95132 --- compiler-rt/lib/arm/sync_synchronize.S | 33 +++++++++++++++++++++++++ compiler-rt/make/platform/darwin_bni.mk | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 compiler-rt/lib/arm/sync_synchronize.S diff --git a/compiler-rt/lib/arm/sync_synchronize.S b/compiler-rt/lib/arm/sync_synchronize.S new file mode 100644 index 000000000000..40b584e109f2 --- /dev/null +++ b/compiler-rt/lib/arm/sync_synchronize.S @@ -0,0 +1,33 @@ +//===-- sync_synchronize - Implement memory barrier * ----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "../assembly.h" + +// +// When compiling a use of the gcc built-in __sync_synchronize() in thumb1 mode +// the compiler may emit a call to __sync_synchronize. +// On Darwin the implementation jumps to an OS supplied function named +// OSMemoryBarrier +// + + .text + .syntax unified + +#if __APPLE__ + +DEFINE_COMPILERRT_PRIVATE_FUNCTION(__sync_synchronize) + stmfd sp!, {r7, lr} + add r7, sp, #0 + bl _OSMemoryBarrier + ldmfd sp!, {r7, pc} + + // tell linker it can break up file at label boundaries + .subsections_via_symbols + +#endif diff --git a/compiler-rt/make/platform/darwin_bni.mk b/compiler-rt/make/platform/darwin_bni.mk index aadda42ab291..a7d8989800cf 100644 --- a/compiler-rt/make/platform/darwin_bni.mk +++ b/compiler-rt/make/platform/darwin_bni.mk @@ -54,6 +54,7 @@ FUNCTIONS.armv6 := $(FUNCTIONS) \ subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ modsi3 umodsi3 udivsi3 divsi3 \ switch8 switchu8 switch16 switch32 \ - restore_vfp_d8_d15_regs save_vfp_d8_d15_regs + restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ + sync_synchronize VISIBILITY_HIDDEN := 0