Edit report at http://bugs.php.net/bug.php?id=54895&edit=1
ID: 54895
User updated by: mhei at heimpold dot de
Reported by: mhei at heimpold dot de
Summary: Fix compiling with older gcc version without need
for membar_producer macro
Status: Open
Type: Bug
Package: Compile Failure
Operating System: Linux (OpenWRT backfire)
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Forgot to mention that I actually tested it already: the compilation
succeeded.
Previous Comments:
------------------------------------------------------------------------
[2011-05-20 21:46:00] mhei at heimpold dot de
Description:
------------
When compiling the latest php version 5.3.6 with OpenWRT backfire
branch, the build fails:
-snip-
ext/standard/php_crypt_r.o: In function `_crypt_extended_init_r':
php_crypt_r.c:(.text+0x4c1): undefined reference to `membar_producer'
php_crypt_r.c:(.text+0x4cf): undefined reference to `atomic_add_int'
collect2: ld returned 1 exit status
make[3]: *** [sapi/cli/php] Error 1
-snap-
When looking into the source file I'm wondering whether the second code
path with __sync_fetch_and_add could not be used.
-snip-
#ifdef PHP_WIN32
InterlockedIncrement(&initialized);
#elif (defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 2))
__sync_fetch_and_add(&initialized, 1);
#elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
membar_producer();
atomic_add_int(&initialized, 1);
#endif
-snap-
As gcc compiler version 4.1.2 has support for this function (see
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html) I
suggest the attached patch to lower the GNUC_MINOR test.
Expected result:
----------------
The build completes as the gcc provided function is used.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54895&edit=1