From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org
Cc: Christophe Lyon <christophe.lyon@linaro.org>,
Jason Merrill <jason@redhat.com>,
gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: RFA (libstdc++): PATCH to implement C++17 over-aligned new
Date: Sat, 10 Sep 2016 10:35:00 -0000 [thread overview]
Message-ID: <20160910101704.GG23306@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1609101102110.3340@laptop-mg.saclay.inria.fr>
On 10/09/16 11:25 +0200, Marc Glisse wrote:
>On Sat, 10 Sep 2016, Christophe Lyon wrote:
>
>>On aarch64*-elf and arm-eabi (using newlib), I'm seeing:
>>/gccsrc/libstdc++-v3/libsupc++/new_opa.cc:66: undefined reference to
>>`aligned_alloc'
>
>https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=f86afe5a3ac62a92e821c764a011e1625abdd326
>
>"C11 aligned_alloc() implementation
>
>aligned_alloc() is implemented in terms of posix_memalign() which is
>only declared in <stdlib.h> but not defined in Newlib in general. At
>least Linux and RTEMS implement this function."
>
>If we don't want to provide a fallback implementation in libsupc++, we
>can say that aligned new is unsupported on those platforms, but if we
>are building a shared libstdc++.so that doesn't like undefined
>symbols, we need a different failure mode than an undefined
>aligned_alloc. Either not providing operator new(...aligned_val_t...)
>in libstdc++ or providing one that just aborts I guess?
Or always fails with bad_alloc:
--- a/libstdc++-v3/libsupc++/new_opa.cc
+++ b/libstdc++-v3/libsupc++/new_opa.cc
@@ -49,8 +49,11 @@ aligned_alloc (std::size_t al, std::size_t sz)
#define aligned_alloc memalign
#else
// The C library doesn't provide any aligned allocation functions, declare
-// aligned_alloc and get a link failure if aligned new is used.
-extern "C" void *aligned_alloc(std::size_t, std::size_t);
+// an aligned_alloc that always fails.
+static void *aligned_alloc(std::size_t, std::size_t)
+{
+ _GLIBCXX_THROW_OR_ABORT(bad_alloc());
+}
#endif
#endif
That would work unless/until we get a fallback.
next prev parent reply other threads:[~2016-09-10 10:17 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 7:10 Jason Merrill
2016-09-08 8:32 ` Marc Glisse
2016-09-08 11:18 ` Jonathan Wakely
2016-09-09 21:40 ` Jason Merrill
2016-09-10 7:03 ` Christophe Lyon
2016-09-10 10:14 ` Marc Glisse
2016-09-10 10:35 ` Jonathan Wakely [this message]
2016-09-11 9:14 ` Christophe Lyon
2016-09-11 9:55 ` Jonathan Wakely
2016-09-11 9:56 ` Jonathan Wakely
2016-09-11 10:20 ` Christophe Lyon
2016-09-11 12:09 ` Jonathan Wakely
2016-09-13 13:04 ` Szabolcs Nagy
2016-09-10 10:14 ` Jonathan Wakely
2016-09-11 7:09 ` Andreas Schwab
2016-09-12 21:13 ` Jason Merrill
2016-09-13 8:41 ` Christophe Lyon
2016-09-13 12:37 ` Andreas Schwab
2016-09-13 12:54 ` Jason Merrill
2016-09-13 13:18 ` Andreas Schwab
2016-09-13 13:21 ` Jason Merrill
2016-09-14 12:13 ` Andreas Schwab
2016-09-14 16:11 ` Christophe Lyon
2016-09-14 16:37 ` Jason Merrill
2016-09-15 10:00 ` Rainer Orth
2016-09-15 12:23 ` Christophe Lyon
2016-09-15 20:09 ` Jason Merrill
2016-09-16 7:12 ` Rainer Orth
2016-09-16 8:15 ` Christophe Lyon
2016-09-16 9:14 ` Jonathan Wakely
2016-09-16 9:51 ` Marc Glisse
2016-09-16 11:12 ` Jonathan Wakely
2016-09-16 13:13 ` Jonathan Wakely
2016-09-16 13:17 ` Rainer Orth
2016-09-16 18:19 ` Jonathan Wakely
2016-09-12 14:15 ` Rainer Orth
2016-09-12 16:19 ` Jonathan Wakely
2016-09-12 18:57 ` Jason Merrill
2016-09-14 12:11 ` Rainer Orth
2016-09-08 11:00 ` Jonathan Wakely
2017-11-24 14:26 ` Marc Glisse
2017-11-29 21:23 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160910101704.GG23306@redhat.com \
--to=jwakely@redhat.com \
--cc=christophe.lyon@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).