MIPS atomic builtins

James Molloy jamesmol@transitive.com
Tue May 6 11:50:00 GMT 2008


Hi,

I'm compiling for the mips64el-elf target and would like to use gcc's 
atomic builtin functions as provided by this patch:

http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00839.html

I'm using GCC 4.3.0, and a quick grep of the source tree tells me that 
the above patch has been applied already (it was not, on GCC 4.2.3).

I'm configuring with the option --with-llsc=yes, and the configure and 
compile completes successfully, however when I attempt to compile 
sources which use the builtin __sync_bool_compare_and_swap or 
__sync_add_and_fetch I still get an unresolved external link error;

 > CMakeFiles/kernel.dir/core/process/Semaphore.cc.o: In function 
`Atomic<int>::compareAndSwap(int, int)':
 > 
(.text._ZN6AtomicIiE14compareAndSwapEii[Atomic<int>::compareAndSwap(int, 
int)]+0x30): undefined reference to `__sync_bool_compare_and_swap_4'

When I try to compile with the -mllsc option, as suggested by the patch 
description, cc1plus quits with an invalid command line option error.

I'd appreciate it if someone could give me a hint as to how to get gcc 
to use its builtins for my MIPS target - it should be noted however that 
I am compiling with -mips32; that is I am compiling 32-bit mips code 
(which is intended to be run on a 64-bit processor - an r4000 compatible).

Thanks,

James Molloy



More information about the Gcc-help mailing list