https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93384

            Bug ID: 93384
           Summary: Python 3.9.0a3 fails to build on ppc64le with GCC
                    10.0.1: redefined symbol cannot be used on reloc
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vstinner at redhat dot com
  Target Milestone: ---

Hi,

We are working on upgrading Python 3.8 to 3.9 in Fedora Rawhide. Two builds
ago, the build was fine on the 3 archs (x86-64, aarch64, ppc64), but when GCC
has been upgraded from GCC 9.2.1 to GCC 10.0.1, we started the get the
following error on ppc64le (and only on this arch, the two others are building
successfully):

/tmp/cc7LZ1xH.s: Assembler messages:
/tmp/cc7LZ1xH.s:91549: Error: redefined symbol cannot be used on reloc
/tmp/cc7LZ1xH.s:275099: Error: redefined symbol cannot be used on reloc
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Full build logs:
https://kojipkgs.fedoraproject.org//work/tasks/606/40790606/build.log

We build Python using LTO and PGO.

The first step of PGO (-fprofile-generate) went fine, but the second step
(-fprofile-use) is the one which failed.

GCC error message is unclear :-( I'm not sure if the error comes from the build
of a single .c file, or on the linking command creating libpython3.9.so from
all .o files.

A Python .c file is built with a command like (that's the second PGO step,
using -fprofile-use -fprofile-correction):
---
gcc
 -pthread
 -c
 -Wno-unused-result
 -Wsign-compare
 -DDYNAMIC_ANNOTATIONS_ENABLED=1
 -DNDEBUG 
 -O2
 -g
 -pipe
 -Wall
 -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -fexceptions
 -fstack-protector-strong
 -grecord-gcc-switches  
 -m64
 -mcpu=power8
 -mtune=power8
 -fasynchronous-unwind-tables
 -fstack-clash-protection
 -D_GNU_SOURCE
 -fPIC
 -fwrapv
 -O2
 -g
 -pipe
 -Wall
 -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -fexceptions
 -fstack-protector-strong
 -grecord-gcc-switches  
 -m64
 -mcpu=power8
 -mtune=power8
 -fasynchronous-unwind-tables
 -fstack-clash-protection
 -D_GNU_SOURCE
 -fPIC
 -fwrapv  
 -O2
 -g
 -pipe
 -Wall
 -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -fexceptions
 -fstack-protector-strong
 -grecord-gcc-switches  
 -m64
 -mcpu=power8
 -mtune=power8
 -fasynchronous-unwind-tables
 -fstack-clash-protection
 -D_GNU_SOURCE
 -fPIC
 -fwrapv  
 -O2
 -g
 -pipe
 -Wall
 -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -fexceptions
 -fstack-protector-strong
 -grecord-gcc-switches
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -m64
 -mcpu=power8
 -mtune=power8
 -fasynchronous-unwind-tables
 -fstack-clash-protection
 -D_GNU_SOURCE
 -fPIC
 -fwrapv
 -fno-semantic-interposition
 -flto
 -fuse-linker-plugin
 -ffat-lto-objects
 -flto-partition=none
 -g
 -std=c99
 -Wextra
 -Wno-unused-result
 -Wno-unused-parameter
 -Wno-missing-field-initializers
 -Werror=implicit-function-declaration
 -fvisibility=hidden
 -O2
 -g
 -pipe
 -Wall
 -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2
 -Wp,-D_GLIBCXX_ASSERTIONS
 -fexceptions
 -fstack-protector-strong
 -grecord-gcc-switches
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -m64
 -mcpu=power8
 -mtune=power8
 -fasynchronous-unwind-tables
 -fstack-clash-protection
 -D_GNU_SOURCE
 -fPIC
 -fwrapv
 -fno-semantic-interposition 
 -fprofile-use
 -fprofile-correction
 -I/builddir/build/BUILD/Python-3.9.0a2/Include/internal
 -IObjects
 -IInclude
 -IPython
 -I.
 -I/builddir/build/BUILD/Python-3.9.0a2/Include  
 -fPIC
 -DPy_BUILD_CORE
 -o Python/Python-ast.o
/builddir/build/BUILD/Python-3.9.0a2/Python/Python-ast.c
---

Link libpython3.9.so:
---
gcc
 -pthread
 -shared
 -Wl,-z,relro
 -Wl,--as-needed
 -Wl,-z,now
 -g
 -Wl,-z,relro
 -Wl,--as-needed
 -Wl,-z,now
 -g
 -Wl,-z,relro
 -Wl,--as-needed
 -Wl,-z,now
 -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
 -fno-semantic-interposition
 -g
 -flto
 -fuse-linker-plugin
 -ffat-lto-objects
 -flto-partition=none
 -g
 -Wl,-z,relro
 -Wl,--as-needed
 -Wl,-z,now
 -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
 -fno-semantic-interposition
 -g
 -o libpython3.9.so

 -lcrypt
 -lpthread
 -ldl
 -lutil
 -lm
 -lm

 Modules/getbuildinfo.o
 Parser/acceler.o
 Parser/grammar1.o
 Parser/listnode.o
 Parser/node.o
 Parser/parser.o
 Parser/token.o
 Parser/myreadline.o
 Parser/parsetok.o
 Parser/tokenizer.o
 Objects/abstract.o
 Objects/accu.o
 Objects/boolobject.o
 Objects/bytes_methods.o
 Objects/bytearrayobject.o
 Objects/bytesobject.o
 Objects/call.o
 Objects/capsule.o
 Objects/cellobject.o
 Objects/classobject.o
 Objects/codeobject.o
 Objects/complexobject.o
 Objects/descrobject.o
 Objects/enumobject.o
 Objects/exceptions.o
 Objects/genobject.o
 Objects/fileobject.o
 Objects/floatobject.o
 Objects/frameobject.o
 Objects/funcobject.o
 Objects/interpreteridobject.o
 Objects/iterobject.o
 Objects/listobject.o
 Objects/longobject.o
 Objects/dictobject.o
 Objects/odictobject.o
 Objects/memoryobject.o
 Objects/methodobject.o
 Objects/moduleobject.o
 Objects/namespaceobject.o
 Objects/object.o
 Objects/obmalloc.o
 Objects/picklebufobject.o
 Objects/rangeobject.o
 Objects/setobject.o
 Objects/sliceobject.o
 Objects/structseq.o
 Objects/tupleobject.o
 Objects/typeobject.o
 Objects/unicodeobject.o
 Objects/unicodectype.o
 Objects/weakrefobject.o
 Python/_warnings.o
 Python/Python-ast.o
 Python/asdl.o
 Python/ast.o
 Python/ast_opt.o
 Python/ast_unparse.o
 Python/bltinmodule.o
 Python/ceval.o
 Python/codecs.o
 Python/compile.o
 Python/context.o
 Python/dynamic_annotations.o
 Python/errors.o
 Python/frozenmain.o
 Python/future.o
 Python/getargs.o
 Python/getcompiler.o
 Python/getcopyright.o
 Python/getplatform.o
 Python/getversion.o
 Python/graminit.o
 Python/hamt.o
 Python/import.o
 Python/importdl.o
 Python/initconfig.o
 Python/marshal.o
 Python/modsupport.o
 Python/mysnprintf.o
 Python/mystrtoul.o
 Python/pathconfig.o
 Python/peephole.o
 Python/preconfig.o
 Python/pyarena.o
 Python/pyctype.o
 Python/pyfpe.o
 Python/pyhash.o
 Python/pylifecycle.o
 Python/pymath.o
 Python/pystate.o
 Python/pythonrun.o
 Python/pytime.o
 Python/bootstrap_hash.o
 Python/structmember.o
 Python/symtable.o
 Python/sysmodule.o
 Python/thread.o
 Python/traceback.o
 Python/getopt.o
 Python/pystrcmp.o
 Python/pystrtod.o
 Python/pystrhex.o
 Python/dtoa.o
 Python/formatter_unicode.o
 Python/fileutils.o
 Python/dynload_shlib.o
 Python/pydtrace.o
 Modules/config.o
 Modules/getpath.o
 Modules/main.o
 Modules/gcmodule.o
 Modules/posixmodule.o
 Modules/errnomodule.o
 Modules/pwdmodule.o
 Modules/_sre.o
 Modules/_codecsmodule.o
 Modules/_weakref.o
 Modules/_functoolsmodule.o
 Modules/_operator.o
 Modules/_collectionsmodule.o
 Modules/_abc.o
 Modules/itertoolsmodule.o
 Modules/atexitmodule.o
 Modules/signalmodule.o
 Modules/_stat.o
 Modules/timemodule.o
 Modules/_threadmodule.o
 Modules/_localemodule.o
 Modules/_iomodule.o
 Modules/iobase.o
 Modules/fileio.o
 Modules/bytesio.o
 Modules/bufferedio.o
 Modules/textio.o
 Modules/stringio.o
 Modules/faulthandler.o
 Modules/_tracemalloc.o
 Modules/hashtable.o
 Modules/symtablemodule.o
 Modules/xxsubtype.o
 Python/frozen.o
---

Python configure options:
---
./configure
 --build=ppc64le-redhat-linux-gnu
 --host=ppc64le-redhat-linux-gnu
 --program-prefix=
 --disable-dependency-tracking
 --prefix=/usr
 --exec-prefix=/usr
 --bindir=/usr/bin
 --sbindir=/usr/sbin
 --sysconfdir=/etc
 --datadir=/usr/share
 --includedir=/usr/include
 --libdir=/usr/lib64
 --libexecdir=/usr/libexec
 --localstatedir=/var
 --sharedstatedir=/var/lib
 --mandir=/usr/share/man
 --infodir=/usr/share/info
 --enable-ipv6
 --enable-shared
 --with-computed-gotos=yes
 --with-dbmliborder=gdbm:ndbm:bdb
 --with-system-expat
 --with-system-ffi
 --enable-loadable-sqlite-extensions
 --with-dtrace
 --with-lto
 --with-ssl-default-suites=openssl
 --with-valgrind
 --without-ensurepip
 --enable-optimizations
---

I found the error message in GNU gas assembler:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gas/write.c;h=5d9a2394224d0c36129cc70f0d5755c7014ff9bb;hb=HEAD#l1169

The error message is quite old, it has been added in 2008:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=76d1293995586b060a2dc642a72c877db7092580;hp=b96e292732664fd8c63970ca11c3a9ac92f60ff9

--

Fedora builds of python39:

https://koschei.fedoraproject.org/package/python39

Build 40639489 is green, build 40790556 is red. One interesting difference is
GCC 9.2.1 upgraded to GCC 10.0.1.


All differences (Dependency changes from previous build):

glibc-devel
2.30.9000-29.fc32
2.30.9000-30.fc32
1
redhat-rpm-config
146-1.fc32
148-1.fc32
1
gcc-c++
9.2.1-1.fc32.3
10.0.1-0.3.fc32
1
glibc-all-langpacks
2.30.9000-29.fc32
2.30.9000-30.fc32
1
sqlite-devel
3.30.1-2.fc32
3.30.1-3.fc32
1
glibc-common
2.30.9000-29.fc32
2.30.9000-30.fc32
2
perl-Exporter
5.73-440.fc31
5.74-1.fc32
2
gcc
9.2.1-1.fc32.3
10.0.1-0.3.fc32
2
annobin
8.92-1.fc32
9.01-1.fc32
2
sqlite
3.30.1-2.fc32
3.30.1-3.fc32
2
libxcrypt-devel
4.4.10-2.fc32
4.4.11-1.fc32
2
libstdc++-devel
9.2.1-1.fc32.3
10.0.1-0.3.fc32
2
libgcc
9.2.1-1.fc32.3
10.0.1-0.3.fc32
2
glibc
2.30.9000-29.fc32
2.30.9000-30.fc32
2
sqlite-libs
3.30.1-2.fc32
3.30.1-3.fc32
2
libxcrypt
4.4.10-2.fc32
4.4.11-1.fc32
2
glibc-headers
2.30.9000-29.fc32
2.30.9000-30.fc32
2
libstdc++
9.2.1-1.fc32.3
10.0.1-0.3.fc32
2
fontconfig-devel
2.13.92-3.fc32
2.13.92-4.fc32
3
cpp
9.2.1-1.fc32.3
10.0.1-0.3.fc32
3
tzdata
2019c-1.fc32
2019c-2.fc32
3
kernel-headers
5.5.0-0.rc6.git0.1....
5.5.0-0.rc7.git0.1....
3
libgomp
9.2.1-1.fc32.3
10.0.1-0.3.fc32
3
fontconfig
2.13.92-3.fc32
2.13.92-4.fc32
3
glibc-minimal-langpack
2.30.9000-29.fc32
2.30.9000-30.fc32
3
libtool-ltdl
2.4.6-31.fc31
2.4.6-32.fc32

Reply via email to