Red Hat Bugzilla – Bug 455712
undefined reference to Built-in functions for atomic memory access
Last modified: 2008-07-19 15:38:41 EDT
Description of problem:
Sorry if I'm doing this wrong but I've tried compiling the attached test program
on a Ubuntu system and it works fine (using GCC 4.2.3). When attempting to use
the Built-in functions for atomic memory access
the built-in functions give an undefined reference error:
[smc@localhost ~]$ gcc -Wall test.c
/tmp/ccIRjIFU.o: In function `inc':
test.c:(.text+0x15): undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
Version-Release number of selected component (if applicable):
I've attached a simple program to demonstrate the problem. As best I can tell,
this program should compile and link.
Created attachment 312027 [details]
Test program source
That's user error. You can't use them on CPUs that don't support them.
You likely don't have a plain i386 and i486 and higher already support them,
so just compile with -march=i486, -march=i586, -march=i686 or higher.