classification
Title: mc68881 fpcr inline asm breaks clang -flto build
Type: compile error Stage:
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Configure script wrongly detects x64/x87/mc68881 with -flto option passed
View: 24543
Assigned To: Nosy List: ivank, schwab
Priority: normal Keywords:

Created on 2014-08-03 07:12 by ivank, last changed 2015-07-02 12:22 by skrah. This issue is now closed.

Messages (3)
msg224613 - (view) Author: ivank (ivank) Date: 2014-08-03 07:12
Build cpython master with clang -flto results in:

[...]
ar rc libpython3.5m.a Modules/_threadmodule.o  Modules/signalmodule.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/itertoolsmodule.o  Modules/atexitmodule.o  Modules/_stat.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/zipimport.o  Modules/faulthandler.o  Modules/_tracemalloc.o Modules/hashtable.o  Modules/symtablemodule.o  Modules/xxsubtype.o
ranlib libpython3.5m.a
clang -pthread -flto -B/usr/lib/gold-ld -flto -B/usr/lib/gold-ld -Xlinker -export-dynamic -o python Programs/python.o libpython3.5m.a -lpthread -ldl  -lutil   -lm  
clang -pthread -flto -B/usr/lib/gold-ld -flto -B/usr/lib/gold-ld -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.5m.a -lpthread -ldl  -lutil   -lm  
<inline asm>:1:10: error: invalid register name
        fmove.l %fpcr,36(%rsp)
                ^~~~~
LLVM ERROR: Error parsing inline asm

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [python] Error 1
make: *** Waiting for unfinished jobs....
<inline asm>:1:10: error: invalid register name
        fmove.l %fpcr,36(%rsp)
                ^~~~~
LLVM ERROR: Error parsing inline asm

clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1



My build script was:

#!/bin/bash

# Get clang 3.5 from
# deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main
# deb-src http://llvm.org/apt/trusty/ llvm-toolchain-trusty main

set -e

sudo ln -sf /usr/lib/llvm-3.5/lib/LLVMgold.so /usr/lib/LLVMgold.so
sudo mkdir -p /usr/lib/bfd-plugins
sudo ln -sf /usr/lib/llvm-3.5/lib/LLVMgold.so /usr/lib/bfd-plugins/LLVMgold.so
grep -Fxq /usr/lib/llvm-3.5/lib /etc/ld.so.conf || (echo "/usr/lib/llvm-3.5/lib should be in /etc/ld.so.conf" && false)
sudo ldconfig

export CC=clang
export CXX=clang++
export CFLAGS="-O3 -flto -B/usr/lib/gold-ld -fomit-frame-pointer"
export CXXFLAGS="-O3 -flto -B/usr/lib/gold-ld -fomit-frame-pointer"
export LDFLAGS="-flto -B/usr/lib/gold-ld" 
make clean || echo "Can't make clean"
./configure --prefix=/opt/leakless
make -j17


It works fine without the -flto/gold-ld options.
msg224630 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2014-08-03 12:49
If it works without -flto, isn't that a toolchain rather than a Python issue?
msg224636 - (view) Author: Andreas Schwab (schwab) * Date: 2014-08-03 13:29
Why does the configure test succeed?
History
Date User Action Args
2015-07-02 12:22:37skrahsetstatus: open -> closed
superseder: Configure script wrongly detects x64/x87/mc68881 with -flto option passed
resolution: duplicate
2014-10-14 15:43:14skrahsetnosy: - skrah
2014-08-03 13:29:08schwabsetmessages: + msg224636
2014-08-03 12:49:52skrahsetnosy: + skrah, schwab
messages: + msg224630
2014-08-03 07:12:42ivankcreate