Re: [PATCH v3 3/3] Aarch64: Fix segfault when casting dummy calls

Alan Hayward
2018-10-30T11:13:48Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1386 bytes --]

> On 29 Oct 2018, at 18:13, Pedro Alves <palves@redhat.com> wrote:
>
> On 10/29/2018 02:56 PM, Alan Hayward wrote:
>
>> A-ha! Now I understand why I get two calls into _push_dummy_call.
>>
>> So to answer your question, the TYPE_CODE_PTR->TYPE_CODE_INT is the malloc call.
>>
>> Then the next call to _push_dummy_call has a return type of 0, as expected.
>> This doesn’t segfault because it goes into language_pass_by_reference which
>> routes to default_pass_by_reference. The same as the C shared library version.
>>
>>
>> I’ve updated the test so it does {c,c++}*{debug nodebug}.
>> I can also update it to do both shared lib and non shared lib too. That should
>> cover everything.
> But still, why do you see a difference between shared library and non-shared
> library?

In all cases the function type is the same.

The difference is because with c++ && shared library, the code ends up in
gnuv3_pass_by_reference(), which means it’s using the GNU G++ Version 3 ABI,
whereas with any other options (non shared or c) it ends up in
default_pass_by_reference().

Looking at the doc for GNU G++ Version 3 ABI:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
The library needs to be linked against libstdc++.so to use it.

A quick ldd shows only the c++ .so is linked against it.

Alan.

\x16º&Öéj×!zÊÞ¶êç×}÷yb²Ö«r\x18\x1dn–­r\x17¬