This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] Fix build problem with eCos/newlib (PR 78110)
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jonathan Wakely <jwakely at redhat dot com>
- Date: Wed, 26 Oct 2016 16:26:36 +0000
- Subject: [PATCH] Fix build problem with eCos/newlib (PR 78110)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=none action=none header.from=hotmail.de;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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.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