diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index d13eee14fbe9d..6397d20e434b1 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -59,9 +59,13 @@ static inline int has_crc32_insn() { # endif } -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC push_options -# pragma GCC target ("+nothing+crc") +# if defined(__GNUC__) +# if!defined(__clang__) +# pragma GCC push_options +# pragma GCC target ("+nothing+crc") +# else +# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function) +# endif # endif static uint32_t crc32_aarch64(uint32_t crc, const char *p, size_t nr) { while (nr >= sizeof(uint64_t)) { @@ -84,8 +88,12 @@ static uint32_t crc32_aarch64(uint32_t crc, const char *p, size_t nr) { } return crc; } -# if defined(__GNUC__) && !defined(__clang__) -# pragma GCC pop_options +# if defined(__GNUC__) +# if !defined(__clang__) +# pragma GCC pop_options +# else +# pragma clang attribute pop +# endif # endif #endif