aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-12-30 09:53:25 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-01-02 12:02:14 +0000
commit50b0f99010bc485e7f60e948ff3bc590fbbeea43 (patch)
tree6dbb283e0dda75c8da136774f55c5fe999263bb7
parent6d16489da847852adb998c5f44b238d0b9c39aaf (diff)
downloadsrc-50b0f99010bc485e7f60e948ff3bc590fbbeea43.tar.gz
src-50b0f99010bc485e7f60e948ff3bc590fbbeea43.zip
Avoid emitting popcnt in libclang_rt.fuzzer*.a if unsupported
Since popcnt is only supported by CPUTYPE=nehalem and later, ensure that this instruction is only emitted when appropriate. Otherwise, programs using the library can abort with SIGILL. See also: https://github.com/llvm/llvm-project/issues/52893 PR: 258156 Reported by: Eric Rucker <bhtooefr@bhtooefr.org> MFC after: 3 days (cherry picked from commit 133180557479cd9676758e6f3f93a9d3e1c6b532)
-rw-r--r--contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h b/contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h
index 1602e6789500..65e77ded8e82 100644
--- a/contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h
+++ b/contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h
@@ -87,7 +87,7 @@
(LIBFUZZER_APPLE || LIBFUZZER_LINUX || LIBFUZZER_NETBSD || \
LIBFUZZER_FREEBSD || LIBFUZZER_EMSCRIPTEN)
-#ifdef __x86_64
+#if defined(__x86_64) && defined(__POPCNT__)
#if __has_attribute(target)
#define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt")))
#else