Re: [PATCH] libstdc++-v3: Have aligned_alloc() on Newlib
Jonathan Wakely <[email protected]>
| Newsgroups | gmane.comp.lib.newlib,gmane.comp.gcc.patches,gmane.comp.gcc.libstdc++.devel |
|---|---|
| Message-ID | <[email protected]> |
On 13/08/18 13:04 +0100, Jonathan Wakely wrote: >On 13/08/18 12:55 +0100, Szabolcs Nagy wrote: >>On 09/08/18 10:08, Jonathan Wakely wrote: >>>On 09/08/18 06:56 +0200, Sebastian Huber wrote: >>>>On 08/08/18 16:33, Jonathan Wakely wrote: >>>>>On 08/08/18 16:22 +0200, Ulrich Weigand wrote: >>>>>>Jonathan Wakely wrote: >>>>>> >>>>>>>Aha, so newlib was using memalign previously: >>>>>>> >>>>>>>@@ -53,20 +54,24 @@ aligned_alloc (std::size_t al, std::size_t sz) >>>>>>>Â #else >>>>>>>Â extern "C" void *memalign(std::size_t boundary, std::size_t size); >>>>>>>Â #endif >>>>>>>-#define aligned_alloc memalign >>>>>> >>>>>>Yes, exactly ... this commit introduced the regression. >>>>>> >>>>>>>OK, I've regressed the branches then - I'll fix that. >>>>> >>>>>This should fix it. I'll finish testing and commit it. >>>>> >>>>>Sebastian, your patch to define HAVE_ALIGNED_ALLOC is OK for >>>>>gcc-7-branch and gcc-8-branch, because changing newlib from using >>>>>memalign to aligned_alloc is safe. >>>> >>>>Should I check in my patch in addition to your patch? >>> >>>Yes please, on trunk and 7 and 8. It's better to use the standard >>>aligned_alloc if available. >>> >> >>but the newlib aligned_alloc is broken on baremetal targets, >>it is implemented using posix_memalign which is not provided >>by the newlib malloc implementation (except on cygwin) > >Ouch, OK, let's revert it. Using memalign is fine. > >The original problem that I think Sebastian was trying to solve should >be fixed by r263409 anyway (and was backported to all branches). I've committed this to trunk and will do so on the branches too.
patch.txt
(text/x-patch, 1001 B)
commit 6fe6d2c2256a73bca9ca3754761bd724b654db13 Author: Jonathan Wakely <[email protected]> Date: Mon Aug 13 14:05:46 2018 +0100 Revert "libstdc++-v3: Have aligned_alloc() on Newlib" This reverts commit r263461 / 2e920cd849b3cf0a72df4f172e27676a3e70b73f because aligned_alloc is not defined for baremetal newlib targets, see https://gcc.gnu.org/ml/libstdc++/2018-08/msg00065.html Revert 2018-08-10 Sebastian Huber <[email protected]> PR target/85904 * configure.ac: Define HAVE_ALIGNED_ALLOC if building for Newlib. * configure: Regenerate. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index e15228dde5e..332af3706d3 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -330,7 +330,6 @@ else AC_DEFINE(HAVE_TANF) AC_DEFINE(HAVE_TANHF) - AC_DEFINE(HAVE_ALIGNED_ALLOC) AC_DEFINE(HAVE_ICONV) AC_DEFINE(HAVE_MEMALIGN) else