add upstream patch to fix aarch64 build

This commit is contained in:
Remi Collet 2019-10-02 15:04:13 +02:00
parent dd8977ea28
commit ed774f7da8
2 changed files with 92 additions and 3 deletions

88
php-aarch64.patch Normal file
View File

@ -0,0 +1,88 @@
From d81eb77b4aaf579c151f7d16eef807838fcef9cc Mon Sep 17 00:00:00 2001
From: Nikita Popov <nikita.ppv@gmail.com>
Date: Wed, 2 Oct 2019 14:41:02 +0200
Subject: [PATCH] Fix AArch64 build
---
ext/standard/crc32.c | 49 ++++++++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 21 deletions(-)
diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c
index 904ea25ff79..853c95ef54f 100644
--- a/ext/standard/crc32.c
+++ b/ext/standard/crc32.c
@@ -21,7 +21,6 @@
#include "crc32.h"
#if defined(__aarch64__)
-# pragma GCC target ("+nothing+crc")
# include <arm_acle.h>
# if defined(__linux__)
# include <sys/auxv.h>
@@ -44,6 +43,31 @@ static inline int has_crc32_insn() {
return res;
# endif
}
+
+# pragma GCC push_options
+# pragma GCC target ("+nothing+crc")
+static uint32_t crc32_aarch64(uint32_t crc, char *p, size_t nr) {
+ while (nr >= sizeof(uint64_t)) {
+ crc = __crc32d(crc, *(uint64_t *)p);
+ p += sizeof(uint64_t);
+ nr -= sizeof(uint64_t);
+ }
+ if (nr >= sizeof(int32_t)) {
+ crc = __crc32w(crc, *(uint32_t *)p);
+ p += sizeof(uint32_t);
+ nr -= sizeof(uint32_t);
+ }
+ if (nr >= sizeof(int16_t)) {
+ crc = __crc32h(crc, *(uint16_t *)p);
+ p += sizeof(uint16_t);
+ nr -= sizeof(uint16_t);
+ }
+ if (nr) {
+ crc = __crc32b(crc, *p);
+ }
+ return crc;
+}
+# pragma GCC pop_options
#endif
/* {{{ proto string crc32(string str)
@@ -63,28 +87,11 @@ PHP_NAMED_FUNCTION(php_if_crc32)
#if defined(__aarch64__)
if (has_crc32_insn()) {
- while(nr >= sizeof(uint64_t)) {
- crc = __crc32d(crc, *(uint64_t *)p);
- p += sizeof(uint64_t);
- nr -= sizeof(uint64_t);
- }
- if (nr >= sizeof(int32_t)) {
- crc = __crc32w(crc, *(uint32_t *)p);
- p += sizeof(uint32_t);
- nr -= sizeof(uint32_t);
- }
- if (nr >= sizeof(int16_t)) {
- crc = __crc32h(crc, *(uint16_t *)p);
- p += sizeof(uint16_t);
- nr -= sizeof(uint16_t);
- }
- if (nr) {
- crc = __crc32b(crc, *p);
- p += sizeof(uint8_t);
- nr -= sizeof(uint8_t);
- }
+ crc = crc32_aarch64(crc, p, nr);
+ RETVAL_LONG(crc^0xFFFFFFFF);
}
#endif
+
for (; nr--; ++p) {
crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32tab[(crc ^ (*p)) & 0xFF ];
}
--
2.11.0

View File

@ -106,6 +106,8 @@ Patch46: php-7.2.4-fixheader.patch
Patch47: php-5.6.3-phpinfo.patch
# Upstream fixes (100+)
# fix for https://bugs.php.net/78622
Patch100: php-aarch64.patch
# Security fixes (200+)
@ -698,9 +700,6 @@ in pure PHP.
%setup -q -n php-%{upver}%{?rcver}
# Workaround to https://bugs.php.net/78622
sed -e 's/__aarch64__/__drop__aarch64__optimization__/' -i ext/standard/crc32.c
%patch1 -p1 -b .mpmcheck
%patch5 -p1 -b .includedir
%patch6 -p1 -b .embed
@ -715,6 +714,7 @@ sed -e 's/__aarch64__/__drop__aarch64__optimization__/' -i ext/standard/crc32.c
%patch47 -p1 -b .phpinfo
# upstream patches
%patch100 -p1 -b .wip
# security patches
@ -1500,6 +1500,7 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || :
- drop dependency on libargon2, use libsodium implementation
- run test suite using 4 concurrent workers
- cleanup unused conditional
- add upstream patch to fix aarch64 build
* Tue Sep 24 2019 Remi Collet <remi@remirepo.net> - 7.3.10-1
- Update to 7.3.10 - http://www.php.net/releases/7_3_10.php