nios2 and atomic operations
joel.sherrill at oarcorp.com
Mon Apr 20 19:50:07 UTC 2015
On 4/20/2015 2:36 PM, Sebastian Huber wrote:
> ----- Joel Sherrill <joel.sherrill at oarcorp.com> schrieb:
>> On 4/20/2015 2:18 PM, Sebastian Huber wrote:
>>> ----- Joel Sherrill <joel.sherrill at oarcorp.com> schrieb:
>>>> As I mentioned earlier, nios2 does not link C++ iostream because of an
>>>> undefined reference:
>>>> more undefined references to `__sync_fetch_and_add_4' follow
>>>> I don't see anything obviously different about this target. Can someone
>>>> take a look at this please? It has to be something small.
>>> I guess Nios II lacks support for atomic operations, so the operating system must provide them in terms of helper functions. Maybe we need a port of libatomic for this target. It looks like something bigger.
>> That's what I was coming to believe. But why don't see this on other
>> I don't see how libatomic would be broken for just Nios2. We don't have
>> specific configuration in it and it only has a few ports.
> As far as I know we have no support of libatomic for RTEMS.
I see no evidence of this but am not sure how the other targets don't
>> What do you mean by "It looks like something bigger"?
> The Linux Nios2 configuration has something like this:
> /* Implement TARGET_INIT_LIBFUNCS. */
> static void
> nios2_init_libfuncs (void)
> /* For Linux, we have access to kernel support for atomic operations. */
> if (TARGET_LINUX_ABI)
> init_sync_libfuncs (UNITS_PER_WORD);
Yeah. We don't have that.
> You have to dig into the GCC configuration, and this is always time consuming. I would file a GCC PR.
I will see if I can duplicate this for nios2-elf first.
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel