[PATCHES] Generate shorter name for extra python files

Lukas Slebodnik lslebodn at redhat.com
Fri Sep 22 20:49:36 UTC 2017


On (23/09/17 08:16), Andrew Bartlett wrote:
>On Fri, 2017-09-22 at 00:07 +0200, Lukas Slebodnik wrote:
>> On (21/09/17 22:38), Lukas Slebodnik via samba-technical wrote:
>> > On (21/09/17 09:27), Andrew Bartlett wrote:
>> > > Thanks for sending in the new patch set.
>> > > 
>> > > My concern is that by having the same python ABI file in samba, it will
>> > > break with:
>> > > 
>> > > #if PY_MAJOR_VERSION < 3
>> > > 
>> > > static void py_cobject_talloc_free(void *ptr)
>> > > {
>> > >         talloc_free(ptr);
>> > > }
>> > > 
>> > > _PUBLIC_ PyObject *pytalloc_CObject_FromTallocPtr(void *ptr)
>> > > {
>> > >         if (ptr == NULL) {
>> > >                 Py_RETURN_NONE;
>> > >         }
>> > >         return PyCObject_FromVoidPtr(ptr, py_cobject_talloc_free);
>> > > }
>> > > 
>> > > #endif
>> > > 
>> > > from pytalloc-util.c
>> > > 
>> > > If you build with python 2 that will not be included in the ABI, and if
>> > > you build with python3 it will.
>> > > 
>> > > That is why we need distinct ABI files for python 2 and python 3.
>> > > 
>> > 
>> > I do not have a problem with distinct ABI files for python 2 and python 3.
>> > Initial version of patches didn't contain it. Files were merged
>> > per requests in previous mails. Or did I misunderstand something?
>> > 
>> 
>> Actually,
>> I cannot see any problem with current patches and
>> pytalloc_CObject_FromTallocPtr
>> 
>> sh# objdump -T /usr/lib64/libpytalloc-util.so.2.1.10 | grep CObject
>> 0000000000000000      DF *UND*  0000000000000000              PyCObject_FromVoidPtr
>> 0000000000001820 g    DF .text  0000000000000024  PYTALLOC_UTIL_2.0.6
>> pytalloc_CObject_FromTallocPtr
>> sh# objdump -T /usr/lib64/libpytalloc-util-cp36m.so.2.1.10 | grep CObject
>> sh# echo $?
>> 1
>> 
>> Andrew,
>> Could you provide me steps to reproduce your case?
>
>I'm talking about the files in Samba's ABI/ subdirectories.  
>
>I misunderstood, I thought there was only going to be one ABI
>file.  However while there are now python3 ABI files I see two
>problems:
>
> - The name (the cp3m bit needs to become .py3 again)
>lib/talloc/ABI/pytalloc-util-cp35m-2.1.10.sigs
>
> - The vscript:
>cat bin/default/lib/talloc/pytalloc-util-cp35m.vscript | grep CObject
>		pytalloc_CObject_FromTallocPtr;
>
>This contains references to CObject_FromTallocPtr
>
But as i showed you in previous example it is not a problem that
symbol is in version script because it is not part of util library
for python3. Version script is used as a whitelist to allow symbols from
objects *.o appear in library. But if symbol is missing in object files
it will not be part of library even though it is in version script.


https://www.akkadia.org/drepper/dsohowto.pdf
Section 2.2 says:
  The concept of export maps is to tell the linker explicitly
  which symbols to export from the generated object.

And it is much simpler to use version script(export maps)
then __attribute__ ((visibility ("hidden")))


But if you prefer to have separate version script(ABI/*) for python2
and python3 I do not have a problem with that. I can just see a small
benefit in de-duplication.

LS



More information about the samba-technical mailing list