aboutsummaryrefslogtreecommitdiff
path: root/lib/libcompiler_rt
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2019-12-26 23:06:28 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2019-12-26 23:06:28 +0000
commit7b6b882fe4cfae4a65f56139e4df6cfb97f72eb2 (patch)
treef457d241f24ebb2cd3b2e346641b6284d49f6278 /lib/libcompiler_rt
parent6795e26b8a77d9c954dfe811e4f5d7a2e529d987 (diff)
downloadsrc-7b6b882fe4cfae4a65f56139e4df6cfb97f72eb2.tar.gz
src-7b6b882fe4cfae4a65f56139e4df6cfb97f72eb2.zip
[PowerPC] enable atomic.c in compiler_rt and do not check and forces
lock/lock_free decisions in compiled time Summary: Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime decision about lock/lock_free. At compiling time, if clang can't decide if atomic operation can be lock free, it emits calls to external functions like `__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and `__atomic_always_lock_free`, postponing decision to a runtime check. According to LLVM code documentation, the mechanism exists due to differences between x86_64 processors that can't be decided at runtime. On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock free, so we force the decision at compile time and avoid having to implement it in an external library. This patch was made after 32 bit users testing the PowePC32 bit ISO reported llvm could not be compiled with in-base llvm due to `__atomic_load8` not implemented. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: jhibbits, dim Differential Revision: https://reviews.freebsd.org/D22549
Notes
Notes: svn path=/head/; revision=356104
Diffstat (limited to 'lib/libcompiler_rt')
-rw-r--r--lib/libcompiler_rt/Makefile.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc
index 22b305c636bf..93c4896c4219 100644
--- a/lib/libcompiler_rt/Makefile.inc
+++ b/lib/libcompiler_rt/Makefile.inc
@@ -205,6 +205,14 @@ CFLAGS+= -DEMIT_SYNC_ATOMICS
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)