From nobody Wed Dec 22 10:06:08 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id ADFAA190609F; Wed, 22 Dec 2021 10:06:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JJpr15ZQLz4Ycd; Wed, 22 Dec 2021 10:06:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 760F31B269; Wed, 22 Dec 2021 10:06:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BMA68OS092282; Wed, 22 Dec 2021 10:06:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BMA687L092281; Wed, 22 Dec 2021 10:06:08 GMT (envelope-from git) Date: Wed, 22 Dec 2021 10:06:08 GMT Message-Id: <202112221006.1BMA687L092281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: b148c7b87148 - stable/12 - Add atomic and bswap functions to libcompiler_rt List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b148c7b87148b653fdbef9c5aa591b9abcd99e26 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640167570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XAKQL9mDSsyerqbk1X5RaLkTDAO4N3bGCYygt4YMiYI=; b=xjPlgJf/e3naMti94648TaoaUiGVmT05ZcKv4fToHXq9HiSNKQ6/5MgQOFD1vP8bFH1HwK H7VLamAX9T2zdFm2qFgpk3hjX0avy++BxKDaSEZe4vH6cnMK4svh4hw/ADRkRQhC2mclUV YFc+ufLc9Pstl95g+whRUAgrJFxNwCKZ7vA689usw89ryKbOq+lLAn0l4mH2ZYqfx4Dci0 Cn1wjtqhrAxJD2Kq8Lz7BYRu2d2cv/Cx8i3uvTql8eNQAMEfdoCy9OOjgMXGTJsDdG3jRr OG+A1U+QZjnSTfMs95eX8ImBdcpt+7M1oGkNA2bimhmMtHWO84QLmBL2vc2DxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640167570; a=rsa-sha256; cv=none; b=Pw/PT5pxvJZAqW7kBVU7RBOhpYjw6u/OGw/vFJi4dz/e0HSf57rEu0AlhsYXfMBu7u0Ugp YFn4n7zPbMayPBh+eu6eK/LWYNs0Ec3kJ59AIyxjP8mcrU2qpeziBXxs9jTyds0FrlpNs5 1R9BtsqO6QfRhInHynPk7ph98qRihMjMTQ7HSCaqaD/+xSWMWotumzqtYypk1ZRUNAhnsf 0ELNILXPRmoyWvKqauUg7aSUDPqfEUS/4qBfs/74WOmPOqopVi9FifVo1bDvQ0B0lGzPih Di6NT3VVqF6nZjy64cCB8IxKR2fU6L8KryA7IUxK6cdsRoDKaFw2NOw+fa78Tw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=b148c7b87148b653fdbef9c5aa591b9abcd99e26 commit b148c7b87148b653fdbef9c5aa591b9abcd99e26 Author: Dimitry Andric AuthorDate: 2020-08-25 06:49:10 +0000 Commit: Dimitry Andric CommitDate: 2021-12-22 09:58:36 +0000 Add atomic and bswap functions to libcompiler_rt There have been several mentions on our mailing lists about missing atomic functions in our system libraries (e.g. __atomic_load_8 and friends), and recently I saw __bswapdi2 and __bswapsi2 mentioned too. To address this, add implementations for the functions from compiler-rt to the system compiler support libraries, e.g. libcompiler_rt.a and and libgcc_s.so. This also needs a small fixup in compiler-rt's atomic.c, to ensure that 32-bit mips can build correctly. Bump __FreeBSD_version to make it easier for port maintainers to detect when these functions were added. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26159 (cherry picked from commit 46c8c5540fe4995e01fcf2e173c05761e7ba9488) --- contrib/llvm-project/compiler-rt/lib/builtins/atomic.c | 4 ++-- lib/libcompiler_rt/Makefile.inc | 6 ++++++ sys/sys/param.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c b/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c index 2a69101fbcee..84d116a36cd9 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c +++ b/contrib/llvm-project/compiler-rt/lib/builtins/atomic.c @@ -125,8 +125,8 @@ static __inline Lock *lock_for_pointer(void *ptr) { #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__) +/// 32 bit MIPS and PowerPC don't support 8-byte lock_free atomics +#if defined(__mips__) || (!defined(__powerpc64__) && defined(__powerpc__)) #define IS_LOCK_FREE_8 0 #else #define IS_LOCK_FREE_8 __c11_atomic_is_lock_free(8) diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index 5766e835ea38..217ea4da0049 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + CRTARCH= ${MACHINE_CPUARCH:C/amd64/x86_64/} CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt/lib/builtins @@ -129,6 +131,10 @@ SRCF+= umodti3 SRCF+= atomic .endif +.if "${COMPILER_TYPE}" == "clang" +CFLAGS.atomic.c+= -Wno-atomic-alignment +.endif + # Avoid using SSE2 instructions on i386, if unsupported. .if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) SRCS+= floatdidf.c diff --git a/sys/sys/param.h b/sys/sys/param.h index 2bfe64db455a..3a7cf79e918b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1203500 /* Master, propagated to newvers */ +#define __FreeBSD_version 1203501 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,