[pypy-commit] pypy release-pypy3.5-5.x: move lto to build option, default is False since some gcc versions produce bogus code

mattip pypy.commits at gmail.com
Mon Jun 5 15:58:04 EDT 2017


Author: Matti Picus <matti.picus at gmail.com>
Branch: release-pypy3.5-5.x
Changeset: r91532:bd5301bc87ef
Date: 2017-06-05 22:54 +0300
http://bitbucket.org/pypy/pypy/changeset/bd5301bc87ef/

Log:	move lto to build option, default is False since some gcc versions
	produce bogus code (grafted from
	c6a3a65d4975769d0767d2d682e4d9741a8042c4)

diff --git a/rpython/config/translationoption.py b/rpython/config/translationoption.py
--- a/rpython/config/translationoption.py
+++ b/rpython/config/translationoption.py
@@ -202,6 +202,9 @@
     BoolOption("lldebug0",
                "If true, makes an lldebug0 build", default=False,
                cmdline="--lldebug0"),
+    BoolOption("lto", "enable link time optimization",
+               default=False, cmdline="--lto",
+               requires=[("translation.gcrootfinder", "shadowstack")]),
     StrOption("icon", "Path to the (Windows) icon to use for the executable"),
     StrOption("libname",
               "Windows: name and possibly location of the lib file to create"),
diff --git a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py
--- a/rpython/translator/platform/posix.py
+++ b/rpython/translator/platform/posix.py
@@ -134,7 +134,7 @@
             cflags = tuple(self.cflags) + tuple(self.standalone_only)
 
         # xxx check which compilers accept this option or not
-        if not config or config.translation.gcrootfinder != 'asmgcc':
+        if config and config.translation.lto:
             cflags = ('-flto',) + cflags
 
         m = GnuMakefile(path)


More information about the pypy-commit mailing list