Page MenuHomeFreeBSD

D22549.id65122.diff
No OneTemporary

D22549.id65122.diff

Index: contrib/compiler-rt/lib/builtins/atomic.c
===================================================================
--- contrib/compiler-rt/lib/builtins/atomic.c
+++ contrib/compiler-rt/lib/builtins/atomic.c
@@ -51,8 +51,8 @@
////////////////////////////////////////////////////////////////////////////////
#ifdef __FreeBSD__
#include <errno.h>
-#include <machine/atomic.h>
#include <sys/types.h>
+#include <machine/atomic.h>
#include <sys/umtx.h>
typedef struct _usem Lock;
__inline static void unlock(Lock *l) {
@@ -117,13 +117,20 @@
return locks + (hash & SPINLOCK_MASK);
}
-/// Macros for determining whether a size is lock free. Clang can not yet
-/// codegen __atomic_is_lock_free(16), so for now we assume 16-byte values are
-/// not lock free.
+/// Macros for determining whether a size is lock free.
#define IS_LOCK_FREE_1 __c11_atomic_is_lock_free(1)
#define IS_LOCK_FREE_2 __c11_atomic_is_lock_free(2)
#define IS_LOCK_FREE_4 __c11_atomic_is_lock_free(4)
+
+/// 32 bit PowerPC doesn't support 8-byte lock_free atomics
+#if !defined(__powerpc64__) && defined(__powerpc__)
+#define IS_LOCK_FREE_8 0
+#else
#define IS_LOCK_FREE_8 __c11_atomic_is_lock_free(8)
+#endif
+
+/// Clang can not yet codegen __atomic_is_lock_free(16), so for now we assume
+/// 16-byte values are not lock free.
#define IS_LOCK_FREE_16 0
/// Macro that calls the compiler-generated lock-free versions of functions
Index: contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
===================================================================
--- contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
+++ contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp
@@ -9896,6 +9896,13 @@
}
}
+ // Don't emit call to external __atomic_always_lock_free for
+ // target FreeBSD on PowerPC 32-bit
+ if (Info.Ctx.getTargetInfo().getTriple().isOSFreeBSD() &&
+ Info.Ctx.getTargetInfo().getTriple().getArch() == llvm::Triple::ppc) {
+ return Success(0, E);
+ }
+
return BuiltinOp == Builtin::BI__atomic_always_lock_free ?
Success(0, E) : Error(E);
}
Index: lib/libcompiler_rt/Makefile.inc
===================================================================
--- lib/libcompiler_rt/Makefile.inc
+++ lib/libcompiler_rt/Makefile.inc
@@ -205,6 +205,14 @@
SRCF+= stdatomic
.endif
+
+.if "${COMPILER_TYPE}" == "clang" && \
+ (${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe")
+SRCS+= atomic.c
+CFLAGS.atomic.c+= -Wno-atomic-alignment
+.endif
+
+
.for file in ${SRCF}
.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
&& exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 3, 9:11 AM (4 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13439831
Default Alt Text
D22549.id65122.diff (2 KB)

Event Timeline