Hi, 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: > > /data/home/joel/rtems-4.11-work/tools/4.12/bin/../lib/gcc/sh > -rtems4.12/6.0.0/ml/m4/libstdc++.a(cxx11-shim_facets.o): In function > `ZNKSt6locale5facet11_M_sso_shimEPKNS_2idE': > /data/home/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sh > -rtems4.12-gcc-6-20160327-newlib-2.4.0-x86_64-linux-gnu-1/build/sh > -rtems4.12/ml/m4/libstdc++ > -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 above. Cheers, Oleg