Merge "Upgrade zlib to abd51836c6dad6c460d236fff70f28cc578a1336"
diff --git a/BUILD.gn b/BUILD.gn
index 1a9cd3b..64a05d1 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/compiler/compiler.gni")
+
if (current_cpu == "arm" || current_cpu == "arm64") {
import("//build/config/arm.gni")
}
@@ -89,7 +91,7 @@
source_set("zlib_arm_crc32") {
visibility = [ ":*" ]
- if (is_clang && !is_ios) {
+ if (!is_ios) {
include_dirs = [ "." ]
if (is_android) {
@@ -101,6 +103,10 @@
} else {
assert(false, "CPU detection requires the Android NDK")
}
+ } else if (!is_win && !is_clang) {
+ assert(!use_thin_lto,
+ "ThinLTO fails mixing different module-level targets")
+ cflags_c = [ "-march=armv8-a+crc" ]
}
sources = [
diff --git a/METADATA b/METADATA
index 3fdb833..d6e42a1 100644
--- a/METADATA
+++ b/METADATA
@@ -1,13 +1,15 @@
name: "zlib"
-description:
- "The Chromium fork of the zlib compression library."
-
+description: "The Chromium fork of the zlib compression library."
third_party {
url {
type: GIT
value: "https://chromium.googlesource.com/chromium/src/third_party/zlib/"
}
- version: "6b6e20f61377df3a532d95087f9fc1324650974b"
- last_upgrade_date { year: 2019 month: 6 day: 6 }
+ version: "abd51836c6dad6c460d236fff70f28cc578a1336"
license_type: NOTICE
+ last_upgrade_date {
+ year: 2019
+ month: 7
+ day: 10
+ }
}
diff --git a/crc32_simd.c b/crc32_simd.c
index 03698ad..2fef610 100644
--- a/crc32_simd.c
+++ b/crc32_simd.c
@@ -161,6 +161,7 @@
* TODO: implement a version using the PMULL instruction.
*/
+#if defined(__clang__)
/* CRC32 intrinsics are #ifdef'ed out of arm_acle.h unless we build with an
* armv8 target, which is incompatible with ThinLTO optimizations on Android.
* (Namely, mixing and matching different module-level targets makes ThinLTO
@@ -183,8 +184,18 @@
#if defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("crc")))
-#else
+#else // !defined(__aarch64__)
#define TARGET_ARMV8_WITH_CRC __attribute__((target("armv8-a,crc")))
+#endif // defined(__aarch64__)
+
+#elif defined(__GNUC__)
+/* For GCC, we are setting CRC extensions at module level, so ThinLTO is not
+ * allowed. We can just include arm_acle.h.
+ */
+#include <arm_acle.h>
+#define TARGET_ARMV8_WITH_CRC
+#else // !defined(__GNUC__) && !defined(_aarch64__)
+#error ARM CRC32 SIMD extensions only supported for Clang and GCC
#endif
TARGET_ARMV8_WITH_CRC
@@ -248,5 +259,4 @@
return ret;
}
-
#endif
diff --git a/zconf.h b/zconf.h
index 7e9ed97..1664387 100644
--- a/zconf.h
+++ b/zconf.h
@@ -8,9 +8,13 @@
#ifndef ZCONF_H
#define ZCONF_H
+/*
+ * This library is also built as a part of AOSP, which does not need to include
+ * chromeconf.h. In that case, neither of these macros will be defined.
+ */
+#if defined(CHROMIUM_BUILD) || defined(GOOGLE_CHROME_BUILD)
/* This include does prefixing as below, but with an updated set of names. Also
* sets up export macros in component builds. */
-#if 0 /* ANDROID: Renaming symbols breaks the AOSP build. */
#include "chromeconf.h"
#endif