mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
[libFuzzer] Check for target(popcnt) capability before usage
Older compilers (e.g. LLVM 3.4) do not support the attribute target("popcnt"). In order to support those, this diff check the attribute support using the preprocessor. Patch by George Karpenkov. Differential Revision: https://reviews.llvm.org/D32311 llvm-svn: 300999
This commit is contained in:
parent
894da66320
commit
9eb170fede
@ -36,12 +36,20 @@
|
||||
#error "Support for your platform has not been implemented"
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#define LIBFUZZER_POSIX LIBFUZZER_APPLE || LIBFUZZER_LINUX
|
||||
|
||||
#ifdef __x86_64
|
||||
#define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt")))
|
||||
# if __has_attribute(target)
|
||||
# define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt")))
|
||||
# else
|
||||
# define ATTRIBUTE_TARGET_POPCNT
|
||||
# endif
|
||||
#else
|
||||
#define ATTRIBUTE_TARGET_POPCNT
|
||||
# define ATTRIBUTE_TARGET_POPCNT
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user