public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Fix freestanding build (PR 92376)
@ 2020-09-17 16:48 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-17 16:48 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:1cf81be019eb7993c1a9946ecdb3f8285c8a95f4

commit 1cf81be019eb7993c1a9946ecdb3f8285c8a95f4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Feb 26 14:20:55 2020 +0000

    libstdc++: Fix freestanding build (PR 92376)
    
    Explicitly declare aligned alloc functions for freestanding, because
    <cstdlib> doesn't declare them.
    
    Backport from mainline
    2020-01-17  Jonathan Wakely  <jwakely@redhat.com>
    
            PR libstdc++/92376
            * libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare allocation
            functions if they were detected by configure.

Diff:
---
 libstdc++-v3/ChangeLog            |  9 +++++++++
 libstdc++-v3/libsupc++/new_opa.cc | 15 +++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8b4637246b9..175107b5b30 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2020-02-26  Jonathan Wakely  <jwakely@redhat.com>
+
+	Backport from mainline
+	2020-01-17  Jonathan Wakely  <jwakely@redhat.com>
+
+	PR libstdc++/92376
+	* libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare allocation
+	functions if they were detected by configure.
+
 2020-02-26  Jonathan Wakely  <jwakely@redhat.com>
 
 	Backport from mainline
diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
index 64b9ccb3493..e48982f7a08 100644
--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -42,6 +42,21 @@ extern "C" void *memalign(std::size_t boundary, std::size_t size);
 using std::new_handler;
 using std::bad_alloc;
 
+#if ! _GLIBCXX_HOSTED
+extern "C"
+{
+# if _GLIBCXX_HAVE_ALIGNED_ALLOC
+  void *aligned_alloc(size_t alignment, size_t size);
+# elif _GLIBCXX_HAVE__ALIGNED_MALLOC
+  void *_aligned_malloc(size_t size, size_t alignment);
+# elif _GLIBCXX_HAVE_POSIX_MEMALIGN
+  void *posix_memalign(void **, size_t alignment, size_t size);
+# elif _GLIBCXX_HAVE_MEMALIGN
+  void *memalign(size_t alignment, size_t size);
+# endif
+}
+#endif
+
 namespace __gnu_cxx {
 #if _GLIBCXX_HAVE_ALIGNED_ALLOC
 using ::aligned_alloc;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-17 16:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 16:48 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] libstdc++: Fix freestanding build (PR 92376) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).