git: 802ff7fcee24 - stable/13 - Avoid emitting popcnt in libclang_rt.fuzzer*.a if unsupported

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 02 Jan 2022 12:02:32 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=802ff7fcee24cb224ea430ac45bece8f8743791f

commit 802ff7fcee24cb224ea430ac45bece8f8743791f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2021-12-30 09:53:25 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-01-02 12:02:19 +0000

    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)
---
 contrib/llvm-project/compiler-rt/lib/fuzzer/FuzzerPlatform.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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