[PATCH, libstdc++] Fix detection of posix_memalig for cross-builds

Christophe Lyon christophe.lyon@linaro.org
Thu Dec 1 07:50:00 GMT 2016


On 1 December 2016 at 01:18, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
> On 12/01/16 00:10, Jonathan Wakely wrote:
>> On 30/11/16 23:06 +0100, Christophe Lyon wrote:
>>> On 30 November 2016 at 22:51, Jonathan Wakely <jwakely@redhat.com> wrote:
>>>> On 30/11/16 22:32 +0100, Christophe Lyon wrote:
>>>>>
>>>>> On 30 November 2016 at 20:00, Bernd Edlinger
>>>>> <bernd.edlinger@hotmail.de>
>>>>> wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I noticed that a cross-compiler produces an unusable libstdc++.so
>>>>>> that contains an unresolved reference to aligned_alloc instead of
>>>>>> posix_memalign, or whatever is actually available.
>>>>>>
>>>>>> Therefore it is impossible to link any C++ programs against the
>>>>>> libstdc++.so that comes with the cross-compiler.
>>>>>>
>>>>>> That happens for instance in the following configuration:
>>>>>> --target=arm-linux-gnueabihf.
>>>>>>
>>>>>
>>>>> How could this be unnoticed so far?
>>>>
>>>>
>>>> I did wonder that.
>>>>
>>>> The newlib config is hardcoded, which probably covers a lot of the
>>>> cross builds in regular use.
>>>>
>>> The config mentioned by Bernd (arm-linux-gnueabihf) does not use newlib.
>>> I checked my libstdc++.log files, there's no -static option in use, I
>>> don't
>>> use --disable-shared, so I'm not sure why there's a problem?
>>
>> Then you probably have a newer glibc that defines aligned_alloc, and
>> Bernd is using an older one that doesn't define it. Bernd?
>>
>
> Yes.
>
> It is from 2011, glibc-2.15 as it looks like.
>
> I never had any issues with that, because it is supposed to be upward
> compatible with newer glibc, I did update the glibc on the target
> system recently to glibc-2.23, though, and had not noticed any issues,
> before.
>

OK, it makes sense: I'm using glibc-2.20.

>
> Thanks
> Bernd.



More information about the Gcc-patches mailing list