Bug #54895 [NEW]: Fix compiling with older gcc version without need for membar_producer macro
| From: | mhei at heimpold dot de | Date: | Fri, 20 May 2011 19:46:01 +0000 |
| Subject: | Bug #54895 [NEW]: Fix compiling with older gcc version without need for membar_producer macro | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160871@lists.php.net to get a copy of this message | ||
From:
Operating system: Linux (OpenWRT backfire)
PHP version: 5.3.6
Package: Compile Failure
Bug Type: Bug
Bug description:Fix compiling with older gcc version without need for membar_producer macro
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 bug report at http://bugs.php.net/bug.php?id=54895&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54895&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54895&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54895&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54895&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54895&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54895&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54895&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54895&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54895&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54895&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54895&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54895&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54895&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54895&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54895&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54895&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54895&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54895&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54895&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54895&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54895&r=mysqlcfg