Bug 624279 - programs using __sync_fetch_and_and() do not build
Summary: programs using __sync_fetch_and_and() do not build
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: gcc
Version: 5.5
Hardware: i386
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-15 15:24 UTC by Avi Kivity
Modified: 2013-01-09 11:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-15 18:42:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Avi Kivity 2010-08-15 15:24:24 UTC
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 18:42:12 UTC
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.