Hi Joel, I have done a test, it seems that '-march=i386' does not provide "__atomic_compare_exchange_n" libs. And '-march=i486' or '-march=pentium' can find the '__atomic_compare_exchange_n' function.
weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -march=i386 -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 /tmp/ccTmf1pa.o: In function `main': test.c:(.text+0xaa): undefined reference to `__atomic_compare_exchange_4' test.c:(.text+0xfa): undefined reference to `__atomic_compare_exchange_4' collect2: error: ld returned 1 exit status weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -march=i486 -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -march=i686 -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -march=i586 -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -march=pentium -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 weiy@ubuntu:~/project/gsoc/gsoc2013/rtems-build/arm-build$ i386-rtems4.11-gcc -m32 -o test test.c /home/weiy/project/gsoc/gsoc2013/rtems-toolchain/4.11/lib/gcc/i386-rtems4.11/4.8.1/../../../../i386-rtems4.11/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048074 /tmp/cctQ68SN.o: In function `main': test.c:(.text+0xaa): undefined reference to `__atomic_compare_exchange_4' test.c:(.text+0xfa): undefined reference to `__atomic_compare_exchange_4' collect2: error: ld returned 1 exit status WeiY Best Regards 在 2013-8-10,上午12:02,Joel Sherrill <joel.sherr...@oarcorp.com> 写道: > On 8/9/2013 10:15 AM, Deng Hengyi wrote: >> Hi all, >> >> does anyone know how to configure gcc to build with >> "__atomic_compare_exchange_n" support for i386 target? > > I recall that one issue with *-rtems* targets is that > we support CPU models which are lower than typically > used on Linux and BSD systems. I recall that CPU > models like the mc68000 and i386 don't necessarily > have the atomic instructions available in later models > like the mc68040 or i686. > > My suggestion is to see specifically how that is > implemented on the other CPU models and which models > don't have implementations. Then we can figure out > how to implement it. > > For lower model CPUs, it should be safe to assume they > will never be seen in SMP systems and using a > generic RTEMS providing implementation that disables > interrupts and does the operation is OK. > > --joel >> WeiY >> Best Regards >> 在 2013-8-6,下午11:37,Jonathan Wakely <jwakely....@gmail.com> 写道: >> >>> On 6 August 2013 16:30, Deng Hengyi wrote: >>>> Hi Jonathan, >>>> >>>> Thank you for your reply. >>>> And about the error i encounter, do you have any advice? maybe it is >>>> caused by my toolchain not install rightly? >>>> In the standard pc686 architecture(not cross compile on RTEMS) will it >>>> encounter the similar error? >>> I don't know anything about the RTEMS port. You might need to build >>> and link to libatomic, but I don't know. > > > -- > Joel Sherrill, Ph.D. Director of Research & Development > joel.sherr...@oarcorp.com On-Line Applications Research > Ask me about RTEMS: a free RTOS Huntsville AL 35805 > Support Available (256) 722-9985 >