From nobody Sat Dec 25 11:56:34 2021 X-Original-To: dev-commits-src-branches@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 3F9F318F4330; Sat, 25 Dec 2021 11:56:39 +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 4JLj834dLXz4lqR; Sat, 25 Dec 2021 11:56:35 +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 434A516F07; Sat, 25 Dec 2021 11:56:34 +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 1BPBuYEK007691; Sat, 25 Dec 2021 11:56:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BPBuYGq007690; Sat, 25 Dec 2021 11:56:34 GMT (envelope-from git) Date: Sat, 25 Dec 2021 11:56:34 GMT Message-Id: <202112251156.1BPBuYGq007690@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: ed0550041614 - stable/12 - Add kludges for old gcc builds of compiler-rt builtins List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: ed0550041614dbb5c2d1d231c7550e1af69f459e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640433396; 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=s6UpIFJdtMiB7NixoyD6e926lSHfFPpdQ5N1IkW6TMI=; b=buafVmncs6cS9lKRnGvulpL+OyMF1zTPA8L2E4aWD/9rGNvHmk1BYUN4Vjk7j7cgj8Bd0V 8pwnAg5Z8HVP+bc6NgHxSykzhYrBVGInOaiRLM+FfmSJEMAkzhMle1QaXJq4uq9pHcS7n7 ifUnx03u9wNcdAS49gTx7Kn3ycn1nYSIcK7lIWq9EENmZW0ohzHgfYFE4OoMHyND4mVP0y jx7iixoQuPf7udNA45jqHtXZSnRb+GcD6BD3LuZIRwEdGYwQQ2avzDC7+a76MGqaZXigW8 yHP5AEkNgUwf7v1UG/LmkP/IEQDnm4pTYrTvyvI/2cevf6YDrFrQobKrRS9zoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640433396; a=rsa-sha256; cv=none; b=Au5TfplWU3KckPym9D461Ol25VYETF0U14HKADfNxFZie1Is6MXJaZPopWAI6RzewYvZ1D AXN3n9CDopyZKIpFTjDgUxTauGj3NXoH6acQ23ODz3R71XjepD65B3UUE4DNiU2jsTk8Lu YqQcs+92riqrXPymlC/T/B2J8IGtaZ16/iKa3+cjBENBUHs+2lZoom0ES1wez9id22DVRn 1+GI+Ww0e2OeRPtcZS1sD1bjpQ77t0jikyJmt2z2nAJOfR4ZNHJk2yaJ1Qp0YBC8/qjlDZ WQOtf6bKQcuYRu1dXOqjXgTE035tUjP2PY/PSErgX3DoYr7qrv7r0pf9NsoreA== 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=ed0550041614dbb5c2d1d231c7550e1af69f459e commit ed0550041614dbb5c2d1d231c7550e1af69f459e Author: Dimitry Andric AuthorDate: 2021-12-25 11:48:53 +0000 Commit: Dimitry Andric CommitDate: 2021-12-25 11:51:45 +0000 Add kludges for old gcc builds of compiler-rt builtins Only use the __libgcc_cmp_return__ mode attribute for gcc > 4.2, as it was only introduced in gcc 4.3.0. Don't use __has_include() for old gcc (actually cpp), as this results in 'missing binary operator before token "("' errors. Also add a forced include, since old gcc refuses to recognize the 'bool' type in freestanding mode. Use the inline __builtin_sadd_overflow() implementation (originally provided for MSVC) for gcc < 5.0, as it was only introduced in gcc 5.0. NOTE: since the llvm project requires at least gcc >= 5.1, these kludges should not be upstreamed. --- .../llvm-project/compiler-rt/lib/builtins/fp_compare_impl.inc | 2 +- contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/fp_compare_impl.inc b/contrib/llvm-project/compiler-rt/lib/builtins/fp_compare_impl.inc index 40fc7df4c679..eba3ca73725f 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/fp_compare_impl.inc +++ b/contrib/llvm-project/compiler-rt/lib/builtins/fp_compare_impl.inc @@ -23,7 +23,7 @@ typedef long long CMP_RESULT; typedef long CMP_RESULT; #endif -#if !defined(__clang__) && defined(__GNUC__) +#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 2)) // GCC uses a special __libgcc_cmp_return__ mode to define the return type, so // check that we are ABI-compatible when compiling the builtins with GCC. typedef int GCC_CMP_RESULT __attribute__((__mode__(__libgcc_cmp_return__))); 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 f10e643363ad..a7051c3ff5a6 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h +++ b/contrib/llvm-project/compiler-rt/lib/builtins/int_lib.h @@ -82,13 +82,14 @@ // back on the latter if not available since NetBSD only has // the latter. // -#if defined(__has_include) && __has_include() +#if defined(__FreeBSD__) // defined(__has_include) && __has_include() #include #else #include #endif #include #include +#include #else // Include the standard compiler builtin headers we use functionality from. #include @@ -156,6 +157,10 @@ int __inline __builtin_clzll(uint64_t value) { #define __builtin_clzl __builtin_clzll +#endif // defined(_MSC_VER) && !defined(__clang__) + +#if !defined(__clang__) && (defined(_MSC_VER) || defined(__GNUC__) && __GNUC__ < 5) + bool __inline __builtin_sadd_overflow(int x, int y, int *result) { if ((x < 0) != (y < 0)) { *result = x + y; @@ -168,6 +173,6 @@ bool __inline __builtin_sadd_overflow(int x, int y, int *result) { return false; } -#endif // defined(_MSC_VER) && !defined(__clang__) +#endif // !defined(__clang__) && (defined(_MSC_VER) || defined(__GNUC__) && __GNUC__ < 5) #endif // INT_LIB_H