diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-28 15:45:18 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2021-12-28 15:45:18 +0000 |
commit | 58f36756505d31a6525d05463fd46c070b9dfb23 (patch) | |
tree | d70d4622590b893600d548390eece3c6d613ecdc /gnu | |
parent | b79c732c9e84b83639c93c38e5b0af802ffb67c6 (diff) |
Compile out-of-line helpers for atomic operations which can be enabled
through -moutline-atomics. These are included by default in this updated
version of compiler-rt, we just haven't enabled them yet. Some ports start
to make use of that option, so it makes sense to provide these helpers.
The helpers would make use of the ARMv8.1 LSE instructions, if we flagged
that the running system supports those. As we do not yet have a mechanism
to show support for LSE, the code will always fall back to regular atomics.
Issue raised by jca@
Tested by phessler@
Input from jsg@
ok kettenis@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/lib/libcompiler_rt/Makefile | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gnu/lib/libcompiler_rt/Makefile b/gnu/lib/libcompiler_rt/Makefile index ba0c4c5fe0f..89db447998a 100644 --- a/gnu/lib/libcompiler_rt/Makefile +++ b/gnu/lib/libcompiler_rt/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2021/04/28 22:56:22 drahn Exp $ +# $OpenBSD: Makefile,v 1.6 2021/12/28 15:45:17 patrick Exp $ .include <bsd.own.mk> @@ -14,6 +14,7 @@ NOPIC= NOPROFILE= CFLAGS+= -fPIC -std=gnu99 -fvisibility=hidden -fno-stack-protector +CPPFLAGS+= -I${.CURDIR}/../../llvm/compiler-rt/lib/builtins CPPFLAGS+= -DVISIBILITY_HIDDEN .if ${MACHINE_ARCH} == "amd64" @@ -210,6 +211,24 @@ SRCS+= comparetf2.c \ multc3.c \ trunctfdf2.c \ trunctfsf2.c + +# Prepare multiple versions of the LSE-helper +CPPFLAGS+=-DHAS_ASM_LSE +.for pat in cas swp ldadd ldclr ldeor ldset +. for size in 1 2 4 8 16 +. for model in 1 2 3 4 +. if "${pat}" == "cas" || "${size}" != "16" +outline_atomic_${pat}${size}_${model}.S: Makefile ${.CURDIR}/../../llvm/compiler-rt/lib/builtins/${RTARCH}/lse.S + @echo "#define L_${pat}\n#define SIZE ${size}\n#define MODEL ${model}\n" > $@.tmp + @cat ${.CURDIR}/../../llvm/compiler-rt/lib/builtins/${RTARCH}/lse.S >> $@.tmp + @mv $@.tmp $@ + +SRCS+= outline_atomic_${pat}${size}_${model}.S +. endif +. endfor +. endfor +.endfor + .endif .if ${RTARCH} == "arm" |