diff mbox

[C++] Aligned new option handling fixes (PR c++/77651)

Message ID CADzB+2kJvkrkE-HgOBcRaT1ocN5MvJGb2_yxL4cJuHoySmZ5Nw@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Sept. 22, 2016, 1:01 p.m. UTC
On Thu, Sep 22, 2016 at 4:58 AM, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> This new test (aligned-new6.C) fails on arm/aarch64 bare-metal targets
> (using newlib):
> arm-none-eabi/./libstdc++-v3/src/.libs/libstdc++.a(new_opa.o): In
> function `operator new(unsigned int, std::align_val_t)':
> /gccsrc/libstdc++-v3/libsupc++/new_opa.cc:76: undefined reference to
> `aligned_alloc'

Hmm, does this fix that?

Comments

Christophe Lyon Sept. 22, 2016, 2:22 p.m. UTC | #1
On 22 September 2016 at 15:01, Jason Merrill <jason@redhat.com> wrote:
> On Thu, Sep 22, 2016 at 4:58 AM, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>> This new test (aligned-new6.C) fails on arm/aarch64 bare-metal targets
>> (using newlib):
>> arm-none-eabi/./libstdc++-v3/src/.libs/libstdc++.a(new_opa.o): In
>> function `operator new(unsigned int, std::align_val_t)':
>> /gccsrc/libstdc++-v3/libsupc++/new_opa.cc:76: undefined reference to
>> `aligned_alloc'
>
> Hmm, does this fix that?

Yes. (I tested on arm only)

Thanks,

Christophe
Jason Merrill Sept. 23, 2016, 2:36 p.m. UTC | #2
On Thu, Sep 22, 2016 at 10:22 AM, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> On 22 September 2016 at 15:01, Jason Merrill <jason@redhat.com> wrote:
>> On Thu, Sep 22, 2016 at 4:58 AM, Christophe Lyon
>> <christophe.lyon@linaro.org> wrote:
>>> This new test (aligned-new6.C) fails on arm/aarch64 bare-metal targets
>>> (using newlib):
>>> arm-none-eabi/./libstdc++-v3/src/.libs/libstdc++.a(new_opa.o): In
>>> function `operator new(unsigned int, std::align_val_t)':
>>> /gccsrc/libstdc++-v3/libsupc++/new_opa.cc:76: undefined reference to
>>> `aligned_alloc'
>>
>> Hmm, does this fix that?
>
> Yes. (I tested on arm only)

Great, applied.

Jason
diff mbox

Patch

commit d94c614feec525860ae3640727a740fb5a0fe9b0
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Sep 22 09:01:16 2016 -0400

            * configure.ac: Define HAVE_MEMALIGN for newlib.

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 6332c4d..973d6d1 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -28822,6 +28822,8 @@  else
 
     $as_echo "#define HAVE_ICONV 1" >>confdefs.h
 
+    $as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h
+
   else
 
 # Base decisions on target environment.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 5657ecb..baf605c 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -324,6 +324,7 @@  else
     AC_DEFINE(HAVE_TANHF)
 
     AC_DEFINE(HAVE_ICONV)
+    AC_DEFINE(HAVE_MEMALIGN)
   else
     GLIBCXX_CROSSCONFIG
   fi