Skip to content

Commit 092726f

Browse files
Fix GH-11785: '++nothing+crc' is not a recognized feature for M1 / M2 macOS compile target (#11796)
#pragma GCC target("+nothing+crc") is means clear outs aarch64_isa_flags. However, #pragma clang attribute push(__attribute__((target("+nothing+crc") is not means any, then displays ignore feature. (Not reproduce Linux on ARM (ex: Raspberry Pi)) Therefore, Add new #pragma when compiling on M1/M2 macOS.
1 parent ae3646d commit 092726f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/standard/crc32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static inline int has_crc32_insn(void) {
6868
# if!defined(__clang__)
6969
# pragma GCC push_options
7070
# pragma GCC target ("+nothing+crc")
71+
# elif defined(__APPLE__)
72+
# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function)
7173
# else
7274
# pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function)
7375
# endif
@@ -96,6 +98,8 @@ static uint32_t crc32_aarch64(uint32_t crc, const char *p, size_t nr) {
9698
# if defined(__GNUC__)
9799
# if !defined(__clang__)
98100
# pragma GCC pop_options
101+
# elif defined(__APPLE__)
102+
# pragma clang attribute pop
99103
# else
100104
# pragma clang attribute pop
101105
# endif

0 commit comments

Comments
 (0)