compilert-rt: build out-of-line LSE atomics helpers for aarch64

Both clang >= 12 and gcc >= 10.1 now default to -moutline-atomics for
aarch64. This requires a bunch of helper functions in libcompiler_rt.a,
to avoid link errors like "undefined symbol: __aarch64_ldadd8_acq_rel".

(Note: of course you can use -mno-outline-atomics as a workaround too,
but this would negate the potential performance benefit of the faster
LSE instructions.)

Bump __FreeBSD_version so ports maintainers can easily detect this.

PR:		257392
MFC after:	2 weeks
This commit is contained in:
Dimitry Andric 2021-07-28 22:30:04 +02:00
parent 441d15a482
commit cc55ee8009
2 changed files with 21 additions and 1 deletions

View File

@ -19,6 +19,26 @@ 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
. 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

View File

@ -76,7 +76,7 @@
* cannot include sys/param.h and should only be updated here.
*/
#undef __FreeBSD_version
#define __FreeBSD_version 1400026
#define __FreeBSD_version 1400027
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,