Fedora Account System
Red Hat Associate
Red Hat Customer
Created attachment 1724449 [details] Output of gcc -E Python/compile.c Description of problem: gcc-10.2.1-5.fc32.x86_64.rpm introduced a regression in LTO build: it worked in the package version 10.2.1-1. GCC no longer exports _Py_Mangle and PyAST_CompileObject functions of Python/compile.c (source) in Python/compile.o (gcc -c). Steps to Reproduce: Use attached compile2.c. $ gcc -pthread -c -DNDEBUG -fwrapv -O1 -finline-functions -finline-small-functions -fpartial-inlining -std=c99 -fvisibility=hidden -I./Include/internal -I. -I./Include -o compile2.o compile2.c -flto $ nm compile2.o|grep _Py_Mangle Actual results: U _Py_Mangle Expected results: 00000000 T _Py_Mangle Additional info: Removing "-finline-functions -finline-small-functions -fpartial-inlining" (only use -O1 optimization flags) works around the issue. The issue was first discovered on the Python project: https://bugs.python.org/issue42164
The original way to reproduce the issue is: git clone https://github.com/python/cpython.git cd cpython export MAKEFLAGS=-j10 ./configure --with-lto make The linker fails since _Py_Mangle and PyAST_CompileObject symbols (of Python/compile.c) are missing (they are supposed to be defined by Python/compile.o).
Jakub: Do you want me to report the issue to GCC upstream? I didn't check if the issue is specific to Fedora or if GCC upstream is also affected.
Can't reproduce that. gcc --version; gcc -pthread -c -DNDEBUG -fwrapv -O1 -finline-functions -finline-small-functions -fpartial-inlining -std=c99 -fvisibility=hidden -I./Include/internal -I. -I./Include -o compile2.o compile2.c -flto; nm compile2.o 2>&1 | grep _Py_Mangle gcc (GCC) 10.2.1 20201005 (Red Hat 10.2.1-5) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00000000 T _Py_Mangle
I cannot reproduce the issue anymore with gcc-10.2.1-9.fc33.x86_64. Maybe it was an issue in another package, not GCC. I don't know. Anyway, I can no longer reproduce the issue on Fedora 33 x86-64. I also closed https://bugs.python.org/issue42164.