summary refs log tree commit diff
path: root/pkgs/development/libraries/v8/gcc_arm.patch
blob: 09579561fd8da03d7b7fad3f48f70a047781ef91 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/third_party/zlib/contrib/optimizations/insert_string.h b/third_party/zlib/contrib/optimizations/insert_string.h
index 1826601..d123305 100644
--- a/third_party/zlib/contrib/optimizations/insert_string.h
+++ b/third_party/zlib/contrib/optimizations/insert_string.h
@@ -26,15 +26,23 @@
   #define _cpu_crc32_u32 _mm_crc32_u32
 
 #elif defined(CRC32_ARMV8_CRC32)
-  #if defined(__clang__)
+  #if defined(__GNUC__) || defined(__clang__)
     #undef TARGET_CPU_WITH_CRC
-    #define __crc32cw __builtin_arm_crc32cw
+    #if defined(__clang__)
+      #define __crc32cw __builtin_arm_crc32cw
+    #elif defined(__GNUC__)
+      #define __crc32cw __builtin_aarch64_crc32cw
+    #endif
   #endif
 
   #define _cpu_crc32_u32 __crc32cw
 
   #if defined(__aarch64__)
-    #define TARGET_CPU_WITH_CRC __attribute__((target("crc")))
+    #if defined(__clang__)
+      #define TARGET_CPU_WITH_CRC __attribute__((target("crc")))
+    #elif defined(__GNUC__)
+      #define TARGET_CPU_WITH_CRC __attribute__((target("+crc")))
+    #endif
   #else  // !defined(__aarch64__)
     #define TARGET_CPU_WITH_CRC __attribute__((target("armv8-a,crc")))
   #endif  // defined(__aarch64__)