php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60328 undefined reference to `__sync_fetch_and_add_4'
Submitted: 2011-11-18 12:53 UTC Modified: 2011-11-18 13:08 UTC
From: a dot wehrmann at centersystems dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.3.8 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a dot wehrmann at centersystems dot com
New email:
PHP Version: OS:

 

 [2011-11-18 12:53 UTC] a dot wehrmann at centersystems dot com
Description:
------------
I tried to cross-compile php-5.3.8 for a Coldfire/m68k V4e target and failed at the linking stage:

php_crypt_r.c:(.text+0x54): undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

I'm using the Codesourcery toolchain
freescale-coldfire-m68k-linux-gnu-2011.03-98 with gcc-4.5.2.

Bug #55231 deals with the same
problem on HPUX. When I changed the following condition in php_crypt_r.c:99 from

#elif (defined(__GNUC__) && !defined(__hpux) && (__GNUC__ > 4 || \
    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1)))))

to 

#elif (defined(__GNUC__) && !defined(__m68k__) && !defined(__hpux) && (__GNUC__ > 4 || \
    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ > 1)))))

everything works fine. You might be interested in the fact that I encountered the same problem using the boost C++ library on the same platform. They offer a macro "DISABLE_FENCED_BLOCKING" (or similar) that when defined prevents the usage of these gcc builtins, see:
http://lists.boost.org/boost-users/2010/09/62566.php

Maybe introducing a #define that allows for disabling the usage of these gcc builtins is a better solution than growing up that condition? Just a thought here...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-18 13:08 UTC] felipe@php.net
-Status: Open +Status: Bogus
 [2011-11-18 13:08 UTC] felipe@php.net
We already have fixed this issue properly in the SVN days ago, see bug #55874.
Now we check if the __sync_fetch_and_add_4 is available in the ./configure.

http://svn.php.net/viewvc/?view=revision&revision=319271

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 21:01:33 2025 UTC