This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: i386 __atomic_compare_exchange_n not found
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: Deng Hengyi <wei dot a dot yang at gmail dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, gcc <gcc at gcc dot gnu dot org>, Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Date: Fri, 9 Aug 2013 11:23:51 -0500
- Subject: Re: i386 __atomic_compare_exchange_n not found
- References: <E56937CF-71B9-4174-8129-B258318A36A8 at gmail dot com> <CAH6eHdRJAbxhqzkxbC0uPyg29yecv3r8vq4277hSDP8z=h_EFw at mail dot gmail dot com> <C0E7F57A-AC3B-4A63-9230-88C927A2C4D2 at gmail dot com> <CAH6eHdTB_jDT_6V__pDP6YfKBRadgnrkiz=imwerodj5xETOaw at mail dot gmail dot com> <50EADE7C-2A5D-4109-8688-41CDF4D80998 at gmail dot com> <520512B1 dot 5050800 at oarcorp dot com> <093B8529-E9C6-4E06-B671-7C75FD28C2E7 at gmail dot com>
On 8/9/2013 11:05 AM, Deng Hengyi wrote:
> 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.
Look in the source for that methods on x86 and see what instruction
it used. If it only got added in i486, then we have to figure out
something for i386. If it was an oversight and the instruction is
on an i386, we fix the code.
> 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.sherrill@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.gcc@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.sherrill@OARcorp.com On-Line Applications Research
>> Ask me about RTEMS: a free RTOS Huntsville AL 35805
>> Support Available (256) 722-9985
>>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985