void-packages/srcpkgs/electron9/files/patches/chromium-gcc-aarch64-zlib-c...

36 lines
1.4 KiB
Diff

Define crc32 intrinsic builtin for gcc
This will fix the build for gcc@aarch64, enabling building V8
with gcc for aarch64.
Bug: 1066302
Change-Id: I4818d6384553a877f6c1c240b7f0c66c8db69b1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315440
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Adenilson Cavalcanti <cavalcantii@chromium.org>
Commit-Queue: Adenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792504}
diff --git a/third_party/zlib/contrib/optimizations/insert_string.h b/third_party/zlib/contrib/optimizations/insert_string.h
index d3bc33c..9f634ae 100644
--- a/third_party/zlib/contrib/optimizations/insert_string.h
+++ b/third_party/zlib/contrib/optimizations/insert_string.h
@@ -28,11 +28,15 @@
#elif defined(CRC32_ARMV8_CRC32)
#if defined(__clang__)
#define __crc32cw __builtin_arm_crc32cw
+ #elif defined(__GNUC__)
+ #define __crc32cw __builtin_aarch64_crc32cw
#endif
- #if defined(__aarch64__)
+ #if defined(__aarch64__) && defined(__clang__)
#define TARGET_CPU_WITH_CRC __attribute__((target("crc")))
- #else // !defined(__aarch64__)
+ #elif defined(__aarch64__) && defined(__GNUC__)
+ #define TARGET_CPU_WITH_CRC __attribute__((target("+crc")))
+ #elif defined(__clang__) // !defined(__aarch64__)
#define TARGET_CPU_WITH_CRC __attribute__((target("armv8-a,crc")))
#endif // defined(__aarch64__)