public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-7832] libstdc++: Declare malloc for freestanding
@ 2021-03-25 18:25 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-03-25 18:25 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:15d649f79d6b6dc336f6a32eec242b652a262a82

commit r11-7832-g15d649f79d6b6dc336f6a32eec242b652a262a82
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Mar 25 18:24:37 2021 +0000

    libstdc++: Declare malloc for freestanding
    
    For a target with none of aligned_alloc, memalign etc. we defined our
    own aligned_alloc using malloc, so we need a declaration of malloc. As
    in libsupc++/new_op.cc we need to declare it ourselves for freestanding
    environments.
    
    libstdc++-v3/ChangeLog:
    
            * libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare malloc.

Diff:
---
 libstdc++-v3/libsupc++/new_opa.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc
index 59296226e83..6b78729dc24 100644
--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -54,6 +54,10 @@ extern "C"
   void *posix_memalign(void **, size_t alignment, size_t size);
 # elif _GLIBCXX_HAVE_MEMALIGN
   void *memalign(size_t alignment, size_t size);
+# else
+  // A freestanding C runtime may not provide "malloc" -- but there is no
+  // other reasonable way to implement "operator new".
+  void *malloc(size_t);
 # endif
 }
 #endif


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

only message in thread, other threads:[~2021-03-25 18:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 18:25 [gcc r11-7832] libstdc++: Declare malloc for freestanding Jonathan Wakely

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).