aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/libsupc++/new_opa.cc4
2 files changed, 10 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1c878a2..de98de1 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2016-10-26 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR libstdc++/78110
+ * libsupc++/new_opa.cc: Don't include <malloc.h> in a free standing
+ environment. Declare memalign directly in that case.
+
2016-10-26 Jonathan Wakely <jwakely@redhat.com>
* testsuite/experimental/filesystem/iterators/pop.cc: Remove
diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
index 91e53a8..4ed1e24 100644
--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -48,7 +48,11 @@ aligned_alloc (std::size_t al, std::size_t sz)
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