Page MenuHomeFreeBSD

D22549.id65614.diff
No OneTemporary

D22549.id65614.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 @@
}
}
+ // Avoid emiting call for runtime decision on PowerPC 32-bit
+ // The lock free possibilities on this platform are covered by the lines
+ // above and we know in advance other cases require lock
+ if (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
Sat, Nov 16, 3:26 AM (7 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14652433
Default Alt Text
D22549.id65614.diff (2 KB)

Event Timeline