com php-src: Fix undefined symbol error when compiling with LLVM: ext/hash/hash_sha3.c
| From: | Stanislav Malyshev | Date: | Sat, 17 Oct 2015 00:23:18 +0000 |
| Subject: | com php-src: Fix undefined symbol error when compiling with LLVM: ext/hash/hash_sha3.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89418@lists.php.net to get a copy of this message | ||
Commit: af68b3ad5f553fe80adaa20fea7358e68ce34359
Author: Stanislav Malyshev <stas@php.net> Fri, 16 Oct 2015 17:23:18 -0700
Parents: 40038d7c5c2322d0d938807d7d4c6d7d001f04f4
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=af68b3ad5f553fe80adaa20fea7358e68ce34359
Log:
Fix undefined symbol error when compiling with LLVM
Basically, LLVM in default mode treats inline in a way incompatible
with GCC in c89 mode, which leads to undefined symbol errors..
See more here: http://stackoverflow.com/questions/12844729/linking-error-for-inline-functions
Changed paths:
M ext/hash/hash_sha3.c
Diff:
diff --git a/ext/hash/hash_sha3.c b/ext/hash/hash_sha3.c
index e82bd24..5898009 100644
--- a/ext/hash/hash_sha3.c
+++ b/ext/hash/hash_sha3.c
@@ -29,15 +29,15 @@
# endif
#endif
-inline php_hash_uint64 rol64(php_hash_uint64 v, unsigned char b) {
+static inline php_hash_uint64 rol64(php_hash_uint64 v, unsigned char b) {
return (v << b) | (v >> (64 - b));
}
-inline unsigned char idx(unsigned char x, unsigned char y) {
+static inline unsigned char idx(unsigned char x, unsigned char y) {
return x + (5 * y);
}
#ifdef WORDS_BIGENDIAN
-inline php_hash_uint64 load64(const unsigned char* x) {
+static inline php_hash_uint64 load64(const unsigned char* x) {
php_hash_uint64 ret = 0;
for (unsigned char i = 7; i >= 0; --i) {
ret <<= 8;
@@ -45,13 +45,13 @@ inline php_hash_uint64 load64(const unsigned char* x) {
}
return ret;
}
-inline void store64(const unsigned char* x, php_hash_uint64 val) {
+static inline void store64(const unsigned char* x, php_hash_uint64 val) {
for (unsigned char i = 0; i < 8; ++i) {
x[i] = val & 0xFF;
val >>= 8;
}
}
-inline void xor64(const unsigned char* x, php_hash_uint64 val) {
+static inline void xor64(const unsigned char* x, php_hash_uint64 val) {
for (unsigned char i = 0; i < 8; ++i) {
x[i] ^= val & 0xFF;
val >>= 8;
@@ -66,7 +66,7 @@ inline void xor64(const unsigned char* x, php_hash_uint64 val) {
# define XORLane(x, y, v) (((php_hash_uint64*)ctx->state)[idx(x,y)] ^= v)
#endif
-inline char LFSR86540(unsigned char* pLFSR)
+static inline char LFSR86540(unsigned char* pLFSR)
{
unsigned char LFSR = *pLFSR;
char result = LFSR & 0x01;