aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2016-10-26 17:26:00 +0000
committerBernd Edlinger <edlinger@gcc.gnu.org>2016-10-26 17:26:00 +0000
commita0019047b8acbda653ba0b250940fe29fca38a6e (patch)
treeb27e4aed666e96844a0a7e22b869e9d1d1482cf0
parent6d5c37d0041f7dc3699623ac7fc7eaf68afbab4b (diff)
downloadgcc-a0019047b8acbda653ba0b250940fe29fca38a6e.zip
gcc-a0019047b8acbda653ba0b250940fe29fca38a6e.tar.gz
gcc-a0019047b8acbda653ba0b250940fe29fca38a6e.tar.bz2
re PR libstdc++/78110 (freestanding libstdc++ fails to compile)
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. From-SVN: r241591
-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