Hi, I noticed that a cross-compiler produces an unusable libstdc++.so that contains an unresolved reference to aligned_alloc instead of posix_memalign, or whatever is actually available.
Therefore it is impossible to link any C++ programs against the libstdc++.so that comes with the cross-compiler. That happens for instance in the following configuration: --target=arm-linux-gnueabihf. The attached patch adds a link test for the memalign function and fixes the cross-build for me. Is it OK for trunk? Thanks Bernd.
2016-11-30 Bernd Edlinger <bernd.edlin...@hotmail.de> * crossconfig.m4 (*-linux*): Add link-check for memalign. * configure: Regenerated. Index: libstdc++-v3/configure =================================================================== --- libstdc++-v3/configure (revision 242960) +++ libstdc++-v3/configure (working copy) @@ -59826,11 +59826,24 @@ _ACEOF fi done + for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if test "${am_cv_func_iconv+set}" = set; then : Index: libstdc++-v3/crossconfig.m4 =================================================================== --- libstdc++-v3/crossconfig.m4 (revision 242960) +++ libstdc++-v3/crossconfig.m4 (working copy) @@ -157,6 +157,7 @@ case "${host}" in AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1) GCC_CHECK_TLS AC_CHECK_FUNCS(__cxa_thread_atexit_impl) + AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) AM_ICONV ;; *-mingw32*)