This is the mail archive of the
mailing list for the GCC project.
Re: Undefined C++ Atomic Symbol on sh-rtems
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>,GCC Mailing List <gcc at gcc dot gnu dot org>,Chris Johns <chrisj at rtems dot org>,Martin Galvan <martin dot galvan at tallertechnologies dot com>
- Date: Sun, 17 Apr 2016 13:33:49 -0500
- Subject: Re: Undefined C++ Atomic Symbol on sh-rtems
- Authentication-results: sourceware.org; auth=none
- References: <5712D1BF dot 7080304 at oarcorp dot com> <1460854221 dot 2115 dot 253 dot camel at t-online dot de>
On April 16, 2016 7:50:21 PM CDT, Oleg Endo <email@example.com> wrote:
>On Sat, 2016-04-16 at 18:58 -0500, Joel Sherrill wrote:
>> I am hoping the solution to this is obvious to someone
>> more familiar with the C++ libraries. Recently the
>> sh4 BSP for RTEMS began to have undefined symbols
>> like this when linking a C++ test:
>> -rtems4.12/6.0.0/ml/m4/libstdc++.a(cxx11-shim_facets.o): In function
>> -v3/include/bits/locale_facets_nonio.h:1065: undefined reference to
>> `__gnu_cxx::__atomic_add(int volatile*, int)'
>> Is this present for sh-elf? Or is there some magic
>> bit missing in the RTEMS configuration stanzas?
>The reason for the above error is that _GLIBCXX_ATOMIC_BUILTINS is not
>set because the atomic model is not set during configure time.
> Normally libstdc++ would use the atomic builtin functions to do its
>stuff, but if they are not enabled during configure,
>_GLIBCXX_ATOMIC_BUILTINS will not be set.
>On SH there are different "atomic models" to choose from, see also the
>-matomic-model= SH target option. Unfortunately, we don't have a way
>to set the default mode during GCC configure phase. I'm planning to
>add this facility to GCC 7, but it should be straight forward to port
>it back if needed.
>For sh4-linux and sh*-linux we currently have some hardcoded atomic
>model default settings in gcc/config/sh/linux.h. The same could be
>done for rtems I guess, but I'd rather go with the configure option
Thanks for the quick and thorough reply.
This doesn't happen with GCC 4.9 which we are using on our newest release branch. With any luck your work will be in gcc 7 before we make another release branch.
Is there a ticket for your plan I should add myself to to track this?