On Tue, 6 Dec 2016 at 17:59, Jonathan Wakely wrote: > >Subject: [PATCH 3/3] Enable libstdc++ compilation in AVR targets > > > >Enable libstdc++ compilation in AVR targets with AVR-Libc. Most > >floating point math functions are already defined in AVR-Libc, so > >defines are in place to avoid multiple definition of these functions. > > I've committed this one too.
Hi Felipe, Back in 2006 we committed a patch from you that made this change: --- a/libstdc++-v3/crossconfig.m4 +++ b/libstdc++-v3/crossconfig.m4 @@ -9,6 +9,32 @@ case "${host}" in # This is a freestanding configuration; there is nothing to do here. ;; + avr*-*-*) + AC_DEFINE(HAVE_ACOSF) + AC_DEFINE(HAVE_ASINF) + AC_DEFINE(HAVE_ATAN2F) + AC_DEFINE(HAVE_ATANF) + AC_DEFINE(HAVE_CEILF) + AC_DEFINE(HAVE_COSF) + AC_DEFINE(HAVE_COSHF) + AC_DEFINE(HAVE_EXPF) + AC_DEFINE(HAVE_FABSF) + AC_DEFINE(HAVE_FLOORF) + AC_DEFINE(HAVE_FMODF) + AC_DEFINE(HAVE_FREXPF) + AC_DEFINE(HAVE_SQRTF) + AC_DEFINE(HAVE_HYPOTF) + AC_DEFINE(HAVE_LDEXPF) + AC_DEFINE(HAVE_LOG10F) + AC_DEFINE(HAVE_LOGF) + AC_DEFINE(HAVE_MODFF) + AC_DEFINE(HAVE_POWF) + AC_DEFINE(HAVE_SINF) + AC_DEFINE(HAVE_SINHF) + AC_DEFINE(HAVE_TANF) + AC_DEFINE(HAVE_TANHF) + ;; + mips*-sde-elf*) # These definitions are for the SDE C library rather than newlib. SECTION_FLAGS='-ffunction-sections -fdata-sections' I'm testing a change today which causes a build failure on avr, because of your config change. I've filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111639 about this, could you take a look please? You said that AVR has those math functions, so we don't need to define them in libstdc++-v3/src/c++98/math_stubs_float.cc but I don't think that's true. It doesn't have them, it has macros like this: extern double acos(double __x) __ATTR_CONST__; #define acosf acos /**< The alias for acos(). */ That does indeed cause build failures in math_stubs_float.cc, but not because of duplicate definitions of acosf etc. And the macro definitions are not acceptable definitions of those functions for a C++ library. I've proposed a fix in the bug report.