Re: undefined builtin atomic operations in gcc4.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Juan Carlos Franzoy wrote:
Hello. I am having problems traying to call __sync_fetch_and_add(int,int). Does anybody know what I'm missing?


the program is a.c:
------------------------ a.c ----------------------------
int i = 0;
int main() {
    int b =  __sync_fetch_and_add( &i, 1 );
    return b;
}
----------------------- end of a.c ----------------------


The error is:
-----------------------------------------------------------------
$ /usr/local/gcc-4.2.2/bin/gcc -oa a.c
/tmp/ccaiRBpH.o(.text+0x21): In function `main':
: undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status

gcc may be defaulting to generating i386 code for compatibility.

I suggest you try -march=CPU

  -march=CPU/-mtune=CPU   generate code/optimize for CPU, where CPU is one of:
                           i386, i486, pentium, pentiumpro, pentium4, nocona,
                           yonah, merom, k6, athlon, k8, generic32, generic64


Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux