-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guard uses of __builtin_clz and __builtin_clzll #884
Conversation
Prevents undefined reference to `__clzdi2' on FreeBSD sparc64 compiled with gcc 4.2 Fallback to the software implementation by making the preprocessor guard better
I see that this only works in clang, and does not fail in gcc on FreeBSD because of a compatibility macro. Will need to revisit this |
Maybe using Also, is there a difference to do between |
We could provide a similar compatibility macro in Zstd, right Allan? As it is, the lack of (something like) this revision in Zstandard makes backporting new versions to FreeBSD more painful than necessary. (Some of our architectures do not provide Or even something dumber like a configure-style HAVE_BUILTIN_CLZ / HAVE_BUILTIN_CLZLL we can enable/disable based on platform defines in one location? |
note that |
Yeah, the problem with the FreeBSD compatibility macro, is that is just returns false, which would be a large pessimization on modern GCC that does have it. |
Sure. We could do |
Yeah, we can definitely make a macro for the test in |
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin(). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.3 files. Note that the 1.3.4 release should be due out soon. Sponsored by: Dell EMC Isilon git-svn-id: svn+ssh://svn.freebsd.org/base/head@330894 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin(). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.3 files. Note that the 1.3.4 release should be due out soon. Sponsored by: Dell EMC Isilon
There is also an problem that even in (recent) gcc, the __has_builtin() itself may be missing; meaning that lib/common/compiler.h should have something like: #ifdef __has_builtin and then you can use HAS_BUILTIN() ... |
@tsoome Yeah, that is basically the compatibility macro that just returns false that @allanjude is describing. Instead we are suggesting specific |
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin(). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.3 files. Note that the 1.3.4 release should be due out soon. Sponsored by: Dell EMC Isilon git-svn-id: https://svn.freebsd.org/base/head@330894 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes our local patch to conditionalize use of __builtin_clz(ll) on Clang's __has_builtin() (which is just defined to false when building with GCC). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.4 files. Reported by: allanjude, Yann Collet Sponsored by: Dell EMC Isilon git-svn-id: svn+ssh://svn.freebsd.org/base/head@331602 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes our local patch to conditionalize use of __builtin_clz(ll) on Clang's __has_builtin() (which is just defined to false when building with GCC). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.4 files. Reported by: allanjude, Yann Collet Sponsored by: Dell EMC Isilon
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin(). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.3 files. Note that the 1.3.4 release should be due out soon. Sponsored by: Dell EMC Isilon git-svn-id: svn+ssh://svn.freebsd.org/base/head@330894 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes our local patch to conditionalize use of __builtin_clz(ll) on Clang's __has_builtin() (which is just defined to false when building with GCC). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.4 files. Reported by: allanjude, Yann Collet Sponsored by: Dell EMC Isilon git-svn-id: svn+ssh://svn.freebsd.org/base/head@331602 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes our local patch to conditionalize use of __builtin_clz(ll) on Clang's __has_builtin() (which is just defined to false when building with GCC). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.4 files. Reported by: allanjude, Yann Collet Sponsored by: Dell EMC Isilon git-svn-id: https://svn.freebsd.org/base/head@331602 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Includes patch to conditionalize use of __builtin_clz(ll) on __has_builtin(). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.3 files. Note that the 1.3.4 release should be due out soon. Sponsored by: Dell EMC Isilon
Includes our local patch to conditionalize use of __builtin_clz(ll) on Clang's __has_builtin() (which is just defined to false when building with GCC). The issue is tracked upstream at facebook/zstd#884 . Otherwise, these are vanilla Zstandard 1.3.4 files. Reported by: allanjude, Yann Collet Sponsored by: Dell EMC Isilon
Prevents undefined reference to `__clzdi2' on FreeBSD sparc64 compiled with gcc 4.2
Fallback to the software implementation by making the preprocessor guard better