diff mbox

Fix build problem with eCos/newlib (PR 78110)

Message ID HE1PR0701MB2169313C5EA68794991DAD09E4AB0@HE1PR0701MB2169.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger Oct. 26, 2016, 4:26 p.m. UTC
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.

Comments

Jonathan Wakely Oct. 26, 2016, 4:30 p.m. UTC | #1
On 26/10/16 16:26 +0000, Bernd Edlinger wrote:
>	* libsupc++/new_opa.cc: Don't include <malloc.h> in a free standing

>	environmnet.  Declare memalign directly in that case.


Typo "environmnet".

OK for trunk, thanks.

We might actually want to avoid <malloc.h> in other cases, as some
systems have a #warning in <malloc.h> saying it's deprecated ...
although they probably have aligned_alloc or posix_memalign anyway so
we won't try to use memalign.
diff mbox

Patch

2016-10-26  Bernd Edlinger  <bernd.edlinger@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