Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 455712 - undefined reference to Built-in functions for atomic memory access
Summary: undefined reference to Built-in functions for atomic memory access
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 9
Hardware: i686
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-17 10:28 UTC by Steven Côté
Modified: 2008-07-19 19:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-19 19:38:41 UTC


Attachments (Terms of Use)
Test program source (deleted)
2008-07-17 10:28 UTC, Steven Côté
no flags Details

Description Steven Côté 2008-07-17 10:28:08 UTC
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
(http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Atomic-Builtins.html#Atomic-Builtins),
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):
gcc-4.3.0-8

How reproducible:
I've attached a simple program to demonstrate the problem. As best I can tell,
this program should compile and link.

Comment 1 Steven Côté 2008-07-17 10:28:08 UTC
Created attachment 312027 [details]
Test program source

Comment 2 Jakub Jelinek 2008-07-19 19:38:41 UTC
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.


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