From nobody Wed Dec 22 10:05:26 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 AAAFB1904906; Wed, 22 Dec 2021 10:05:27 +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 4JJpqB46Fhz4YGW; Wed, 22 Dec 2021 10:05:26 +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 39F281B262; Wed, 22 Dec 2021 10:05:26 +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 1BMA5QZ2091350; Wed, 22 Dec 2021 10:05:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BMA5QQX091349; Wed, 22 Dec 2021 10:05:26 GMT (envelope-from git) Date: Wed, 22 Dec 2021 10:05:26 GMT Message-Id: <202112221005.1BMA5QQX091349@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: 9ba62b3b05d5 - stable/12 - Reapply r230021, r276851 and a few other commits to compiler-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: 9ba62b3b05d56268c1437995317a95af46689a07 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640167526; 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=CLePe0OvGmwEi6RDyKfO4s11Ia5jUnwQWsNPsACd3J4=; b=rh06xuvY37xFY7JaRAPhbxs/XUx2BKDgcfxbYisiAcCuKZ0P9PNRZp0gvSRipjPscIGfPC HD4rYSbwMpQP3NnjoFYRfIo0uWYnxHNFZx7xa472T87Dlg19Iycxa+KasQ6+GE3wLeWxbi NNoCkv4WVYLI+p8zGj5tZlNqDN9jmxC8rHHLH4q87PuDpAtP54h1uQY9wL8WYAqeknvnl6 0Em+vnNZjvg8HINucSW5Qsk1XyE02tZmUZT+e6FdITJgFJTJ/+fIZXNpV2GE4EsmjZRqlm h9Fo+YIdJOPazsn7WQ1kMiVer7rPfj3D/QgwLh/uV1Akk52QJjK+1R9uVsEMJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640167526; a=rsa-sha256; cv=none; b=hcHXoTKBAohcPoetcebaG2OM0weebbcL+QfQVTZ61j8cnS6GAB301ZkzWfWe1PMhKWti9j zfcQ+/1/N+MToswJA6SoVDnjML5Z3+y5Oa5TIPp8WLJjNE8+NCs8DR4AlgVhk6JrNs4qax MrJbR/C3LVYc3kEY8Q7ZdfM1aQjptfhAyly5ZHzfhxEztjv0S8V4lqI7tYyhNVHSqJxpLt GRI04kqBiqE3aRiMD94bv2IpqT2gr97ek0qXQzWJy6A0eOcNHFlZRpezWL76IFwbTJ9FKH Cjy4+InZYuwXkNDYTA74xVcDh86Ua2jTMr7M79E5CG9W+xyFjuf1mQ3Q0c+abg== 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=9ba62b3b05d56268c1437995317a95af46689a07 commit 9ba62b3b05d56268c1437995317a95af46689a07 Author: Dimitry Andric AuthorDate: 2020-08-02 18:07:16 +0000 Commit: Dimitry Andric CommitDate: 2021-12-22 09:58:10 +0000 Reapply r230021, r276851 and a few other commits to compiler-rt Reapply r230021 (by ed): Add a workaround to prevent endless recursion in compiler-rt. SPARC and MIPS CPUs don't have special instructions to count leading/trailing zeroes. The compiler-rt library provides fallback rountines for these. The 64-bit routines, __clzdi2 and __ctzdi2, are implemented as simple wrappers around the compiler built-in __builtin_clz(), assuming these will expand to either 32-bit CPU instructions or calls to __clzsi2 and __ctzsi2. Unfortunately, our GCC 4.2 probably thinks that because the operand is stored in a 64-bit register, it might just be a better idea to invoke its 64-bit equivalent, simply resulting into endless recursion. Fix this by defining __builtin_clz and __builtin_ctz to __clzsi2 and __ctzsi2 explicitly. Reapply r276851: Update compiler-rt to trunk r224034. This brings a number of new builtins, and also the various sanitizers. Support for these will be added in a later commit. (cherry picked from commit 71daeec70a15871cfc0071321cd1e819399aa911) --- .../compiler-rt/lib/builtins/int_lib.h | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h b/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h index 991c4a99ea6e..713deddb5698 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h +++ b/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h @@ -21,7 +21,9 @@ // ABI macro definitions #if __ARM_EABI__ -#ifdef COMPILER_RT_ARMHF_TARGET +#if defined(COMPILER_RT_ARMHF_TARGET) || (!defined(__clang__) && \ + defined(__GNUC__) && (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 5)) +// The pcs attribute was introduced in GCC 4.5.0 #define COMPILER_RT_ABI #else #define COMPILER_RT_ABI __attribute__((__pcs__("aapcs"))) @@ -92,6 +94,29 @@ // Include internal utility function declarations. #include "int_util.h" +/* + * Workaround for LLVM bug 11663. Prevent endless recursion in + * __c?zdi2(), where calls to __builtin_c?z() are expanded to + * __c?zdi2() instead of __c?zsi2(). + * + * Instead of placing this workaround in c?zdi2.c, put it in this + * global header to prevent other C files from making the detour + * through __c?zdi2() as well. + * + * This problem has been observed on FreeBSD for sparc64 and + * mips64 with GCC 4.2.1, and for riscv with GCC 5.2.0. + * Presumably it's any version of GCC, and targeting an arch that + * does not have dedicated bit counting instructions. + */ +#if defined(__FreeBSD__) && (defined(__sparc64__) || \ + defined(__mips_n32) || defined(__mips_n64) || defined(__mips_o64) || \ + defined(__riscv)) +si_int __clzsi2(si_int); +si_int __ctzsi2(si_int); +#define __builtin_clz __clzsi2 +#define __builtin_ctz __ctzsi2 +#endif /* FreeBSD && (sparc64 || mips_n32 || mips_n64 || mips_o64 || riscv) */ + COMPILER_RT_ABI int __paritysi2(si_int a); COMPILER_RT_ABI int __paritydi2(di_int a);