diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2017-11-22 18:30:44 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2017-11-22 18:30:44 +0000 |
commit | be283f57de0037c7e19f0b1b75471f137efdfa1e (patch) | |
tree | 9141b89ff4cb19b288cc96a051b7efbe89daf0f0 /lib/scudo/scudo_utils.h | |
parent | 8d1ef4a759edc138efdfab9c86047739fab8a536 (diff) | |
download | compiler-rt-be283f57de0037c7e19f0b1b75471f137efdfa1e.tar.gz |
[scudo] Overhaul hardware CRC32 feature detection
Summary:
This patch aims at condensing the hardware CRC32 feature detection and making
it slightly more effective on Android.
The following changes are included:
- remove the `CPUFeature` enum, and get rid of one level of nesting of
functions: we only used CRC32, so we just implement and use
`hasHardwareCRC32`;
- allow for a weak `getauxval`: the Android toolchain is compiled at API level
14 for Android ARM, meaning no `getauxval` at compile time, yet we will run
on API level 27+ devices. The `/proc/self/auxv` fallback can work but is
worthless for a process like `init` where the proc filesystem doesn't exist
yet. If a weak `getauxval` doesn't exist, then fallback.
- couple of extra corrections.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: kubamracek, aemerson, srhines, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D40322
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo/scudo_utils.h')
-rw-r--r-- | lib/scudo/scudo_utils.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/scudo/scudo_utils.h b/lib/scudo/scudo_utils.h index cb7300db9..33798194d 100644 --- a/lib/scudo/scudo_utils.h +++ b/lib/scudo/scudo_utils.h @@ -21,7 +21,7 @@ namespace __scudo { template <class Dest, class Source> -inline Dest bit_cast(const Source& source) { +INLINE Dest bit_cast(const Source& source) { static_assert(sizeof(Dest) == sizeof(Source), "Sizes are not equal!"); Dest dest; memcpy(&dest, &source, sizeof(dest)); @@ -30,11 +30,7 @@ inline Dest bit_cast(const Source& source) { void NORETURN dieWithMessage(const char *Format, ...); -enum CPUFeature { - CRC32CPUFeature = 0, - MaxCPUFeature, -}; -bool testCPUFeature(CPUFeature Feature); +bool hasHardwareCRC32(); INLINE u64 rotl(const u64 X, int K) { return (X << K) | (X >> (64 - K)); |