Bug 624279 - programs using __sync_fetch_and_and() do not build
programs using __sync_fetch_and_and() do not build
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc (Show other bugs)
5.5
i386 Linux
low Severity medium
: rc
: ---
Assigned To: Jakub Jelinek
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-15 11:24 EDT by Avi Kivity
Modified: 2013-01-09 06:24 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-15 14:42:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Avi Kivity 2010-08-15 11:24:24 EDT
Description of problem:

Programs using __sync_fetch_and_and() fail to build with a link error:

# make sync_fetch_and_and
cc    -c -o sync_fetch_and_and.o sync_fetch_and_and.c
cc   sync_fetch_and_and.o   -o sync_fetch_and_and
sync_fetch_and_and.o: In function `f':
sync_fetch_and_and.c:(.text+0x15): undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make: *** [sync_fetch_and_and] Error 1


Version-Release number of selected component (if applicable):
gcc-4.1.2-48.el5

How reproducible:
Always

Steps to Reproduce:
1. 'make sync_fetch_and_and' with the following program:

int f(unsigned *p)
{
  return __sync_fetch_and_and(p, 0);
}

int main(int ac, char **av)
{
  unsigned v = 3;
  f(&v);
  return v;
}
  
Actual results:
/tmp/ccsXNXmr.o: In function `f':
sync_fetch_and_and.c:(.text+0x15): undefined reference to `__sync_fetch_and_and_4'
collect2: ld returned 1 exit status


Expected results:
Clean build

Additional info:
Works as expected with gcc44.
Comment 1 Jakub Jelinek 2010-08-15 14:42:12 EDT
Only i486 and up supports that, so you need to compile with -march=i486 or above.  In RHEL6 we default to -march=i686, so you don't need to pass anything special, but in RHEL5 we default to -march=i386.

Note You need to log in before you can comment on or make changes to this bug.