Edit report at http://bugs.php.net/bug.php?id=54895&edit=1

 ID:                 54895
 Updated by:         fel...@php.net
 Reported by:        mhei at heimpold dot de
 Summary:            Fix compiling with older gcc version without need
                     for membar_producer macro
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Linux (OpenWRT backfire)
 PHP Version:        5.3.6
-Assigned To:        
+Assigned To:        felipe
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch!


Previous Comments:
------------------------------------------------------------------------
[2011-05-20 23:24:55] fel...@php.net

Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&revision=311300
Log: - Fixed bug #54895 (Fix compiling with older gcc version without
need for membar_producer macro)
  patch by: mhei at heimpold dot de

------------------------------------------------------------------------
[2011-05-20 21:48:46] mhei at heimpold dot de

Forgot to mention that I actually tested it already: the compilation
succeeded.

------------------------------------------------------------------------
[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

Reply via email to