Title: Fixing a bug related to LTO only build
Type: enhancement Stage: resolved
Components: Build Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, octavian.soldea, vstinner
Priority: normal Keywords:

Created on 2017-09-05 21:54 by octavian.soldea, last changed 2017-09-08 19:16 by gregory.p.smith. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3110 merged octavian.soldea, 2017-09-05 22:48
Messages (3)
msg301381 - (view) Author: Octavian Soldea (octavian.soldea) * Date: 2017-09-05 21:54
Hi All,

This is Octavian Soldea from the Scripting Languages Optimization team at Intel Corporation. I would like to submit a patch to fix an LTO build issue. With "./configure --with-lto" followed by "make", CPython should be built with LTO or Link-Time-Optimization. However, currently, no impact is made to the build process, meaning the flag is not effective. This patch has been created out of a python-dev discussion thread: The LTO flag was originally introduced by my team member Alecsandru Patrascu back in 2015:

Before the change:

./configure --with-lto
gcc command line output example:
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I. -I./Include -DPy_BUILD_CORE -o Python/ceval.o Python/ceval.c
Note no "lto" flag was present. This is the same result as the default build without the LTO flag.

After changes:

./configure --with-lto
expected gcc command line output example =>
gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -I. -I./Include -DPy_BUILD_CORE -o Python/ceval.o Python/ceval.c

msg301385 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-05 22:13
Would you mind to create a pull request?
msg301722 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2017-09-08 19:14
New changeset 4c81401b3a9ffa48fc9e1ffff9963cbad5111e33 by Gregory P. Smith (octaviansoldea) in branch 'master':
bpo-31354: Let configure --with-lto work on all builds
Date User Action Args
2017-09-08 19:16:29gregory.p.smithsetstatus: open -> closed
assignee: gregory.p.smith
resolution: fixed
stage: resolved
2017-09-08 19:14:37gregory.p.smithsetnosy: + gregory.p.smith
messages: + msg301722
2017-09-05 22:48:57octavian.soldeasetpull_requests: + pull_request3376
2017-09-05 22:13:35vstinnersetnosy: + vstinner
messages: + msg301385
2017-09-05 21:54:13octavian.soldeacreate