util: Solve "invalid target attribute" building error

When building SPDK on aarch64, met error about invalid target attribute 'bmi',
'arch=core2' and 'arch=atom'.

Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: I369e61005e6550045e24d84147a71b5dd25c4a52
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466848
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Richael Zhuang 2019-08-30 09:18:05 +08:00 committed by Jim Harris
parent be04cfc342
commit d40944a256

View File

@ -60,7 +60,8 @@ extern "C" {
/* The following will automatically generate several version of /* The following will automatically generate several version of
* this function, targeted at different architectures. This * this function, targeted at different architectures. This
* is only supported by GCC 6 or newer. */ * is only supported by GCC 6 or newer. */
#if defined(__GNUC__) && __GNUC__ >= 6 && !defined(__clang__) #if defined(__GNUC__) && __GNUC__ >= 6 && !defined(__clang__) \
&& (defined(__i386__) || defined(__x86_64__))
__attribute__((target_clones("bmi", "arch=core2", "arch=atom", "default"))) __attribute__((target_clones("bmi", "arch=core2", "arch=atom", "default")))
#endif #endif
static inline uint32_t static inline uint32_t
@ -82,7 +83,8 @@ spdk_align32pow2(uint32_t x)
/* The following will automatically generate several version of /* The following will automatically generate several version of
* this function, targeted at different architectures. This * this function, targeted at different architectures. This
* is only supported by GCC 6 or newer. */ * is only supported by GCC 6 or newer. */
#if defined(__GNUC__) && __GNUC__ >= 6 && !defined(__clang__) #if defined(__GNUC__) && __GNUC__ >= 6 && !defined(__clang__) \
&& (defined(__i386__) || defined(__x86_64__))
__attribute__((target_clones("bmi", "arch=core2", "arch=atom", "default"))) __attribute__((target_clones("bmi", "arch=core2", "arch=atom", "default")))
#endif #endif
static inline uint64_t static inline uint64_t