ABI checks fail when python3 built with link time optimizations

Samuel Cabrero scabrero at suse.de
Tue May 22 10:57:43 UTC 2018


Hi,

this patch removes all flags from CCFLAGS_PYEMBED except -fno-strict-
aliasing, added explicitly by waf's python tool.

I verified only the flags in python_LDFLAGS are removed. For example:

config.log:
python_LDFLAGS = '-flto -fuse-linker-plugin -ffat-lto-objects -flto-
partition=none'

Without patch:
[ 729/4153] Compiling lib/talloc/pytalloc_util.c
runner /usr/bin/gcc ... -flto -fuse-linker-plugin -ffat-lto-objects
-flto-partition=none -fno-strict-aliasing ...

With patch:
[ 729/4153] Compiling lib/talloc/pytalloc_util.c
runner /usr/bin/gcc ... -fno-strict-aliasing ...

Review and push appreciated.

On Fri, 2018-05-11 at 05:38 +1200, Andrew Bartlett via samba-technical
wrote:
> On Thu, 2018-05-10 at 18:54 +0200, Samuel Cabrero via samba-technical
> wrote:
> > Hi,
> > 
> > I found that configuring with:
> > 
> > ./configure.developer --picky-developer --extra-
> > python=/usr/bin/python3
> > 
> > on openSUSE tumbleweed ABI checks of python3 modules fail because
> > gdb
> > can't find debug info:
> > 
> > libpyldb-util.cpython-36m-x86-64-linux-gnu.so: symbol
> > pyldb_Dn_FromDn
> > has changed - please update major version
> > 	old_signature: PyObject *(struct ldb_dn *)
> > 	new_signature: <text variable, no debug info>
> > 
> > Tracing it down I found that python3 is built --with-lto, and the
> > returned LDFLAGS are:
> > 
> > > > > from distutils.sysconfig import get_config_var
> > > > > print((get_config_var("LDFLAGS")))
> > 
> > -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none
> > 
> > These flags end in the python_LDFLAGS variable and are used to
> > build
> > the python modules together with '-g' when building with debug or
> > in
> > developer mode. According to GCC documentation this is currently
> > experimental and can produce unexpected results, like no debug
> > information in this case.
> > 
> > Should we strip out '-flto' from the LDFLAGS returned by python
> > when
> > building with debug or in developer mode?
> 
> Yes.  We may or make not like LTO, but we shouldn't get such stuff
> magically from python.  Please filter aggressively, we really just
> want
> libraries to link to, not compiler features.
> 
> Thanks,
> 
> Andrew Bartlett
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-wafsamba-Do-not-bring-features-or-optimizations-from.patch
Type: text/x-patch
Size: 1226 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180522/7b6bf60e/0001-wafsamba-Do-not-bring-features-or-optimizations-from.bin>


More information about the samba-technical mailing list