mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
8524dc53fd
[builtins][AArch64] Implement _sync out-of-line atomics Whilst Clang does not use these, recent GCC does, and so on systems such as FreeBSD that wish to use compiler-rt as the system runtime library but also wish to support building programs with GCC these interfaces are needed. This is a light adaptation of the code committed to GCC by Sebastian Pop <spop@amazon.com>, relicensed with permission for use in compiler-rt. Fixes https://github.com/llvm/llvm-project/issues/63483 Reviewed By: sebpop, MaskRay Differential Revision: https://reviews.llvm.org/D158536 Reviewed by: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41716
49 lines
1.2 KiB
Makefile
49 lines
1.2 KiB
Makefile
|
|
.include <src.opts.mk>
|
|
|
|
PACKAGE= lib${LIB}
|
|
LIB= compiler_rt
|
|
MK_SSP= no
|
|
NO_PIC=
|
|
WARNS?= 2
|
|
|
|
CFLAGS+= ${PICFLAG}
|
|
CFLAGS+= -fvisibility=hidden
|
|
CFLAGS+= -DVISIBILITY_HIDDEN
|
|
CFLAGS+= -I${SRCTOP}/contrib/llvm-project/libunwind/include
|
|
|
|
# gcc has incompatible internal declarations for __divtc3 and __multc3, but has
|
|
# no option to silence its warning, so make warnings non-fatal.
|
|
MK_WERROR.gcc= no
|
|
|
|
.include "Makefile.inc"
|
|
|
|
# Out-of-line LSE atomics helpers for aarch64
|
|
.if ${MACHINE_CPUARCH} == "aarch64"
|
|
. for pat in cas swp ldadd ldclr ldeor ldset
|
|
. for size in 1 2 4 8 16
|
|
. for model in 1 2 3 4 5
|
|
. if ${pat} == "cas" || ${size} != "16"
|
|
# Use .for to define lse_name, to get a special loop-local variable
|
|
. for lse_name in outline_atomic_${pat}${size}_${model}.S
|
|
CLEANFILES+= ${lse_name}
|
|
STATICOBJS+= ${lse_name:R}.o
|
|
ACFLAGS.${lse_name}+= -DL_${pat} -DSIZE=${size} -DMODEL=${model} -I${CRTSRC}
|
|
${lse_name}: lse.S
|
|
ln -sf ${.ALLSRC} ${.TARGET}
|
|
. endfor # lse_name
|
|
. endif
|
|
. endfor # model
|
|
. endfor # size
|
|
. endfor # pat
|
|
.endif
|
|
|
|
.if ${MK_INSTALLLIB} != "no"
|
|
SYMLINKS+= libcompiler_rt.a ${LIBDIR}/libgcc.a
|
|
.endif
|
|
.if ${MK_PROFILE} != "no"
|
|
SYMLINKS+= libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
|
|
.endif
|
|
|
|
.include <bsd.lib.mk>
|