Note that there are some explanatory texts on larger screens.

plurals
  1. POundefined reference to `__sync_val_compare_and_swap_4' error at compilation, using gcc 4.1.1 and 4.2.0 for Sparc v8 target
    primarykey
    data
    text
    <p>Using <a href="http://kegel.com/crosstool/" rel="nofollow">crosstool</a> scripts i've built under <a href="http://www.cygwin.com/" rel="nofollow">Cygwin</a> the following compilers gcc-4.1.1 and 4.2.0 20061024 (prerelease) for Sparc architecture:</p> <pre><code>$ ./sparc-unknown-linux-gnu-gcc -v Using built-in specs. Target: sparc-unknown-linux-gnu Configured with: /crosstool-0.43/build/sparc-unknown-linux-gnu/gcc-4.1.1-glibc-2.3.6/gcc-4.1.1/configure --target=sparc-unknown-linux-gnu --host=i686-host_pc-cygwin --prefix=/opt/crosstool/gcc-4.1.1-glibc-2.3.6/sparc-unknown-linux-gnu --with-headers=/opt/crosstool/gcc-4.1.1-glibc-2.3.6/sparc-unknown-linux-gnu/sparc-unknown-linux-gnu/include --with-local-prefix=/opt/crosstool/gcc-4.1.1-glibc-2.3.6/sparc-unknown-linux-gnu/sparc-unknown-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long Thread model: posix gcc version 4.1.1 </code></pre> <p>and</p> <pre><code>$ ./sparc-unknown-linux-gnu-gcc -v Using built-in specs. Target: sparc-unknown-linux-gnu Configured with: /crosstool-0.43/build/sparc-unknown-linux-gnu/gcc-4.2-20061024- glibc-2.3.6/gcc-4.2-20061024/configure --target=sparc-unknown-linux-gnu --host=i 686-host_pc-cygwin --prefix=/opt/crosstool/gcc-4.2-20061024-glibc-2.3.6/sparc-un known-linux-gnu --with-headers=/opt/crosstool/gcc-4.2-20061024-glibc-2.3.6/sparc -unknown-linux-gnu/sparc-unknown-linux-gnu/include --with-local-prefix=/opt/cros stool/gcc-4.2-20061024-glibc-2.3.6/sparc-unknown-linux-gnu/sparc-unknown-linux-g nu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atex it --enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long Thread model: posix gcc version 4.2.0 20061024 (prerelease) </code></pre> <p>It is necessary for me that i can use in my programs <code>__sync_val_compare_and_swap</code> function related to the <a href="http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html" rel="nofollow">Atomic-Builtins</a>, which supports whith 4.1.* version of gcc.</p> <p>I try to compile simple C code:</p> <pre><code>long cmpxchg( long* value, long comp_val, long new_val ) { return __sync_val_compare_and_swap( value, comp_val, new_val ); } int main() { return 0; } </code></pre> <p>But i have the following error: (on both compilers):</p> <pre><code>$ ./sparc-unknown-linux-gnu-gcc test_cas.c -o test_cas /tmp/ccREXHsP.o: In function `cmpxchg': test_cas.c:(.text+0x24): undefined reference to `__sync_val_compare_and_swap_4' collect2: ld returned 1 exit status </code></pre> <p>What's the problem? May be i wrong built compilers? May be Sparc architecture (SPARC v8) doesn't support this feature? I tried to compile my another programs - all good (compiled and executed).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload