This is the mail archive of the
mailing list for the GCC project.
Re: Undefined C++ Atomic Symbol on sh-rtems
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>, 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 09:50:21 +0900
- Subject: Re: Undefined C++ Atomic Symbol on sh-rtems
- Authentication-results: sourceware.org; auth=none
- References: <5712D1BF dot 7080304 at oarcorp dot com>
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