Hi,

this patch avoids including malloc.h in free standing builds with
eCos/newlib, and declares the memalign directly.


Successfully built a cross compiler for eCos.
Is it OK for trunk?


Thanks
Bernd.
2016-10-26  Bernd Edlinger  <bernd.edlin...@hotmail.de>

	* libsupc++/new_opa.cc: Don't include <malloc.h> in a free standing
	environmnet.  Declare memalign directly in that case.

--- libstdc++-v3/libsupc++/new_opa.cc.orig	2016-09-16 20:09:14.000000000 +0200
+++ libstdc++-v3/libsupc++/new_opa.cc	2016-10-26 09:40:41.722542566 +0200
@@ -48,7 +48,11 @@
   return nullptr;
 }
 #elif _GLIBCXX_HAVE_MEMALIGN
+#if _GLIBCXX_HOSTED
 #include <malloc.h>
+#else
+extern "C" void *memalign(std::size_t boundary, std::size_t size);
+#endif
 #define aligned_alloc memalign
 #else
 // The C library doesn't provide any aligned allocation functions, declare

Reply via email to