This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author T.Rex
Recipients Ayappan, BTaskaya, David.Edelsohn, Michael.Felt, T.Rex
Date 2020-07-27.09:22:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595841763.73.0.238086985523.issue38628@roundup.psfhosted.org>
In-reply-to
Content
On AIX 7.2, with libffi compiled with -O0 -g, I have:

1) Call to memchr thru memchr_args_hack
#0  0x09000000001b0d60 in memchr () from /usr/lib/libc.a(shr_64.o)
#1  0x09000000058487a0 in ffi_call_DARWIN () from /opt/freeware/lib/libffi.a(libffi.so.6)
#2  0x0900000005847eec in ffi_call (cif=0xfffffff, fn=0xffffca90, rvalue=0xfffffff, avalue=0xffffca80) at ../src/powerpc/ffi_darwin.c:31
#3  0x09000000058f9900 in ?? ()
#4  0x09000000058ebb6c in ?? ()
#5  0x090000000109fc18 in _PyObject_MakeTpCall () from /opt/freeware/lib64/libpython3.8.so

r3             0xa000000003659e0        720575940382841312
r4             0x64     100
r5             0x7      7
(gdb) x/s $r3
0xa000000003659e0:      "abcdef"

2) Call to memchr thru memchr_args_hack2
#0  0x09000000001b0d60 in memchr () from /usr/lib/libc.a(shr_64.o)
#1  0x09000000058487a0 in ffi_call_DARWIN () from /opt/freeware/lib/libffi.a(libffi.so.6)
#2  0x0900000005847eec in ffi_call (cif=0xfffffff, fn=0xffffca90, rvalue=0xfffffff, avalue=0xffffca80) at ../src/powerpc/ffi_darwin.c:31
#3  0x09000000058f9900 in ?? ()
#4  0x09000000058ebb6c in ?? ()
#5  0x090000000109fc18 in _PyObject_MakeTpCall () from /opt/freeware/lib64/libpython3.8.so

r3             0xa000000003659e0        720575940382841312
r4             0x64     100
r5             0x0      0

So, it looks like, when libffi is not compiled with -O but with -O0 -g, that in 64bit ffi_call_DARWIN() is call in both cases (memchr_args_hack and memchr_args_hack2).
However, as seen previously, it was not the case with libffi built with -O .

Moreover, we have in source code:
  switch (cif->abi)
    {
    case FFI_AIX:
      ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
                   FFI_FN(ffi_prep_args));
      break;
    case FFI_DARWIN:
      ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
                      FFI_FN(ffi_prep_args), cif->rtype);

Why calling ffi_call_DARWIN instead of ffi_call_AIX ?

Hummm Will rebuild libffi and python both with gcc -O0 -g -gdwarf and look at details.
History
Date User Action Args
2020-07-27 09:22:43T.Rexsetrecipients: + T.Rex, David.Edelsohn, Michael.Felt, Ayappan, BTaskaya
2020-07-27 09:22:43T.Rexsetmessageid: <1595841763.73.0.238086985523.issue38628@roundup.psfhosted.org>
2020-07-27 09:22:43T.Rexlinkissue38628 messages
2020-07-27 09:22:43T.Rexcreate