This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Configure script wrongly detects x64/x87/mc68881 with -flto option passed
Type: compile error Stage: resolved
Components: Build Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: skrah Nosy List: ivank, mliska@suse.cz, python-dev, schwab, skrah
Priority: normal Keywords:

Created on 2015-07-01 10:41 by mliska@suse.cz, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (12)
msg246034 - (view) Author: marxin (mliska@suse.cz) Date: 2015-07-01 10:41
I've just tried to build Python with {C,CXX,LD}FLAGS set to '-flto'.

Unfortunately following conftest source file is fragile:

cat /tmp/mc.c
int
main ()
{

  unsigned int fpcr;
  __asm__ __volatile__ ("fmove.l %%fpcr,%0" : "=g" (fpcr));
  __asm__ __volatile__ ("fmove.l %0,%%fpcr" : : "g" (fpcr));

  ;
  return 0;
}

gcc --version:
gcc (GCC) 5.1.1 20150424 (prerelease)

gcc -c /tmp/mc.c
/tmp/mc.c: Assembler messages:
/tmp/mc.c:6: Error: no such instruction: `fmove.l %fpcr,%eax'
/tmp/mc.c:7: Error: no such instruction: `fmove.l -4(%rbp),%fpcr'

gcc -flto -c /tmp/mc.c

As GCC does not produce assembly with -flto and -c (unless you append -ffat-lto-objects), the compilation success.

Can you please write more robust configuration.
Thanks,
Martin
msg246046 - (view) Author: Andreas Schwab (schwab) * Date: 2015-07-01 20:11
That means these tests are broken as well:

AC_MSG_CHECKING(for x64 gcc inline assembler)
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
msg246072 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-02 11:57
Okay, I'll have a look then (I first assumed this was mc68881 specific).
msg246074 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-02 13:04
In what way are the x64/x87 tests broken? ./configure runs smoothly
here (gcc 4.8.2) with and without -flto.

Can you try "=m" and "m" for the asm output operands?
msg246075 - (view) Author: marxin (mliska@suse.cz) Date: 2015-07-02 13:10
As I wrote, starting from GCC 4.9.0, the compiler does not emit any assembly with -flto and -c option. I would suggest to remove '-c' option that will force to create an executable.
msg246079 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-02 14:28
"-c" is apparently generated by AC_COMPILE_IFELSE, which uses ac_compile.

The alternative is using AC_RUN_IFELSE, which uses ac_link.


Do you see any other possibility of dropping the "-c" during ./configure?
msg246083 - (view) Author: Andreas Schwab (schwab) * Date: 2015-07-02 15:17
Please use AC_LINK_IFELSE.  No need for a runtime test that breaks cross compilation.
msg246094 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-02 18:31
New changeset 2be983173f45 by Stefan Krah in branch '3.5':
Issue #24543: Use AC_LINK instead of AC_COMPILE in order to prevent false
https://hg.python.org/cpython/rev/2be983173f45

New changeset 8f30776602b4 by Stefan Krah in branch 'default':
Merge from 3.5 (#24543).
https://hg.python.org/cpython/rev/8f30776602b4
msg246095 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-02 19:08
I guess we should backport the x87 fix to 2.7.
msg246167 - (view) Author: marxin (mliska@suse.cz) Date: 2015-07-03 11:37
Works for me.

Thanks!
msg246176 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-03 13:31
New changeset 2a3c0ad52b99 by Stefan Krah in branch '2.7':
Issue #24543: Use AC_LINK instead of AC_COMPILE in order to prevent false
https://hg.python.org/cpython/rev/2a3c0ad52b99
msg246177 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-07-03 13:37
Fixed in 2.7, 3.5 and default.  Thanks everyone for the comments.
History
Date User Action Args
2022-04-11 14:58:18adminsetgithub: 68731
2015-07-03 13:37:07skrahsetstatus: open -> closed

type: compile error
assignee: skrah
components: + Build
versions: + Python 3.4, Python 3.5
messages: + msg246177
resolution: fixed
stage: resolved
2015-07-03 13:31:33python-devsetmessages: + msg246176
2015-07-03 11:37:15mliska@suse.czsetmessages: + msg246167
2015-07-02 19:08:53skrahsetmessages: + msg246095
versions: + Python 2.7, - Python 3.5
2015-07-02 18:31:05python-devsetnosy: + python-dev
messages: + msg246094
2015-07-02 15:17:27schwabsetmessages: + msg246083
2015-07-02 14:28:16skrahsetmessages: + msg246079
2015-07-02 13:10:50mliska@suse.czsetmessages: + msg246075
2015-07-02 13:04:55skrahsetmessages: + msg246074
2015-07-02 12:22:37skrahlinkissue22126 superseder
2015-07-02 12:22:28skrahsetnosy: + ivank
2015-07-02 11:57:12skrahsetnosy: + skrah
messages: + msg246072
2015-07-01 20:12:41schwabsettitle: Configure script wrongly detects mc68881 with -flto option passed -> Configure script wrongly detects x64/x87/mc68881 with -flto option passed
2015-07-01 20:11:34schwabsetmessages: + msg246046
2015-07-01 10:48:43skrahsetnosy: + schwab
2015-07-01 10:41:14mliska@suse.czcreate