Skip to content

Commit 6bc5101

Browse files
committed
hash: Consistently check for PHP_HASH_INTRIN_SHA_* to guard compilation of SHA256_Transform_shani
This fixes the build for amd64 platforms that do not have `HAVE_FUNC_ATTRIBUTE_TARGET`, specifically Alpine/Musl as of now. Closes phpGH-15384. Related to phpGH-15312.
1 parent 74bf894 commit 6bc5101

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
As such, passing invalid types to exit/die may now result in a TypeError
1212
being thrown. (Girgias)
1313

14+
- Hash:
15+
. Fix GH-15384 (Build fails on Alpine / Musl for amd64). (timwolla)
16+
1417
- Standard:
1518
. php_uname() now throws ValueErrors on invalid inputs. (Girgias)
1619

ext/hash/hash_sha_ni.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "php_hash.h"
2828
#include "php_hash_sha.h"
2929

30-
#if (defined(__i386__) || defined(__x86_64__)) && defined(HAVE_IMMINTRIN_H)
30+
#if defined(PHP_HASH_INTRIN_SHA_NATIVE) || defined(PHP_HASH_INTRIN_SHA_RESOLVER)
3131

3232
# include <immintrin.h>
3333

ext/hash/php_hash_sha.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ void SHA256_Transform_sse2(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t
6262
# elif defined(HAVE_FUNC_ATTRIBUTE_TARGET)
6363
# define PHP_HASH_INTRIN_SHA_RESOLVER 1
6464
# endif
65+
#endif
6566

67+
#if defined(PHP_HASH_INTRIN_SHA_NATIVE) || defined(PHP_HASH_INTRIN_SHA_RESOLVER)
6668
void SHA256_Transform_shani(uint32_t state[PHP_STATIC_RESTRICT 8], const uint8_t block[PHP_STATIC_RESTRICT 64]);
6769
#endif
6870

0 commit comments

Comments
 (0)