Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 522788 - dev-python/pypy fails to build with gcc-4.9 - AssertionError: unrecognized function prologue - only supports push %ebp; movl %esp, %ebp
Summary: dev-python/pypy fails to build with gcc-4.9 - AssertionError: unrecognized fu...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alice Ferrazzi
URL: https://bitbucket.org/pypy/pypy/issue...
Whiteboard:
Keywords:
: 568698 (view as bug list)
Depends on:
Blocks: gcc-4.9
  Show dependency tree
 
Reported: 2014-09-14 16:06 UTC by Justin Lecher (RETIRED)
Modified: 2016-01-21 14:58 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
pypy-2.3.1-r1:20140914-143659.log.xz (pypy-2.3.1-r1:20140914-143659.log.xz,21.32 KB, text/plain)
2014-09-14 16:07 UTC, Justin Lecher (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2014-09-14 16:06:15 UTC
translation:ERROR]     data_pypy_module_cpyext_pyobject.c:2638:3: warning: initialization from incompatible pointer type
[translation:ERROR]        (&PyFrozenSet_Type), /* 506.value */
[translation:ERROR]        ^
[translation:ERROR]     data_pypy_module_cpyext_pyobject.c:2638:3: warning: (near initialization for ‘pypy_g_array_783.a.items[506].d_value’)
[translation:ERROR]     data_pypy_module_cpyext_pyobject.c:2643:3: warning: initialization from incompatible pointer type
[translation:ERROR]        (&PyModule_Type), /* 507.value */
[translation:ERROR]        ^
[translation:ERROR]     data_pypy_module_cpyext_pyobject.c:2643:3: warning: (near initialization for ‘pypy_g_array_783.a.items[507].d_value’)
[translation:ERROR]     implement.c: In function ‘pypy_g_descr_typecheck_get_doc’:
[translation:ERROR]     implement.c:12836:10: warning: assignment discards ‘const’ qualifier from pointer target type
[translation:ERROR]       l_v8948 = RPyField(l_v8964, ml_doc);
[translation:ERROR]               ^
[translation:ERROR]     Traceback (most recent call last):
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/trackgcroot.py", line 2082, in <module>
[translation:ERROR]         tracker.process(f, g, filename=fn)
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/trackgcroot.py", line 1975, in process
[translation:ERROR]         tracker = parser.process_function(lines, filename)
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/trackgcroot.py", line 1490, in process_function
[translation:ERROR]         table = tracker.computegcmaptable(self.verbose)
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/trackgcroot.py", line 59, in computegcmaptable
[translation:ERROR]         self.findframesize()
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/trackgcroot.py", line 295, in findframesize
[translation:ERROR]         insn1.framesize = size_at_insn1
[translation:ERROR]       File "/var/cache/portage/tmpdir/portage/dev-python/pypy-2.3.1-r1/work/pypy-2.3.1-src/rpython/translator/c/gcc/../../../../rpython/translator/c/gcc/instruction.py", line 262, in __setattr__
[translation:ERROR]         "unrecognized function prologue - "
[translation:ERROR]     AssertionError: unrecognized function prologue - only supports push %ebp; movl %esp, %ebp
[translation:ERROR]     make: *** [implement.gcmap] Error 1
[translation:ERROR]     """)


$ einfo pypy
Portage 2.2.12 (python 3.3.5-final-0, default/linux/amd64/13.0, gcc-4.9.1-asneeded, glibc-2.19-r1, 3.16.0-lh-nvidia x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.16.0-lh-nvidia-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16343936 total,   8400636 free
KiB Swap:    3987452 total,   3959144 free
Timestamp of tree: Sun, 14 Sep 2014 07:00:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p47
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.8, 3.2.5-r6, 3.3.5-r1, 3.4.1
dev-util/ccache:          3.1.9-r3
dev-util/cmake:           2.8.12.2-r2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.4.7, 4.5.4, 4.6.4, 4.7.4, 4.8.3, 4.9.1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo sunrise betagarden dummy science last-hope
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -ftracer   -march=native -mtune=native -frecord-gcc-switches -fdiagnostics-color=auto -g -Wimplicit-function-declaration"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib/systemd/system /usr/share/eselect/ /usr/share/gnupg/qualified.txt /usr/share/nano/ /var/lib/hsqldb /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -ftracer   -march=native -mtune=native -frecord-gcc-switches -fdiagnostics-color=auto -g -Wenum-compare"
DISTDIR="/var/cache/portage/distfiles"
EMERGE_DEFAULT_OPTS=" -vt --keep-going --autounmask-write --autounmask --quiet-build=n"
FCFLAGS="-O2 -pipe -ftracer   -march=native -mtune=native -frecord-gcc-switches -fdiagnostics-color=auto -g"
FEATURES="assume-digests binpkg-logs buildsyspkg ccache cgroup collision-protect compressdebug distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news noinfo parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -ftracer   -march=native -mtune=native -frecord-gcc-switches -fdiagnostics-color=auto -g"
GENTOO_MIRRORS=" /mnt/tmpfs/ http://gentoo.j-schmitz.net/mirror/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.tu-clausthal.de/pub/linux/gentoo/"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"
MAKEOPTS="-j12 -l9"
PKGDIR="/var/cache/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_COMPRESS_FLAGS="-z -e -9 -v"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--omit-dir-times"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /local/overlays/betagarden /local/overlays/dummy /local/overlays/sci /local/overlays/lh-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 avx bash-completion berkdb branding bzip2 cairo caps cli cracklib crypt cxx dbus dri fortran gdbm gif gmp gnome gnome-keyring gstreamer gtk iconv icu ipv6 jpeg jpeg2k mmx mmxext modules multilib ncurses network-cron nls nptl nsplugin numa opengl openmp pam pcre pgo png pulseaudio qt3support raw readline session smp sse sse2 sse2_4way sse2check sse3 sse4 sse41 sse4_1 sse4_2 sse4a ssl ssse3 startup-notification systemd tcpd threads tiff truetype unicode vaapi vdpau xattr xinerama zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer pdfimport scripting-javascript wiki-publisher nlpsolver" LINGUAS="en" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi stub_status" OFFICE_IMPLEMENTATION="libreoffice" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3 python3_4 pypy" QEMU_SOFTMMU_TARGETS="i386 x86_64 arm armeb" QEMU_USER_TARGETS="i386 x86_64 arm armeb" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.3"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND

=================================================================
                        Package Settings
=================================================================

dev-python/pypy-2.2.1 was built with the following:
USE="bzip2 jit ncurses sqlite tk -doc (-sandbox) -shadowstack (-sse2)"
CFLAGS="-g -march=native -mtune=native -Wimplicit-function-declaration -O3"
CXXFLAGS="-g -march=native -mtune=native -Wenum-compare -O3"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"
Comment 1 Justin Lecher (RETIRED) gentoo-dev 2014-09-14 16:07:32 UTC
Created attachment 384728 [details]
pypy-2.3.1-r1:20140914-143659.log.xz

build.og
Comment 2 Mike Gilbert gentoo-dev 2014-09-17 18:33:27 UTC
I would suggest looking for a bug report upstream, and creating one if none exists already.
Comment 3 Mike Gilbert gentoo-dev 2014-09-17 18:34:02 UTC
Oh, I see Justin has already done so. Nevermind.
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2014-09-17 19:13:47 UTC
I am trying to get the patch backported.
Comment 5 Justin Lecher (RETIRED) gentoo-dev 2014-09-18 07:39:30 UTC
I have no luck, but it seems they plan to release 2.3.2 which should have all that fixed.
Comment 6 Jana Saout 2014-09-29 09:10:30 UTC
Hi,

just wondering if this is because -march=native enables 256 bit AVX.

Because if that happens, gcc 4.9 will happily add code in the function prologue to realign the stack to 256 bits (default for amd64 is 16 byte, i.e. 128 bits) and that function prologue breaks the gcroot analyzer.

A temporary workaround that helper be was to add -mprefer-avx128 to the gcc flags for pypy. (less invasive than deactivating all architecture specific optimizations)

I just tested - pypy 2.4.0 seems to compile fine with all compiler flags, so this issue seems to have been resolved.

(hint: pypy 2.4.0 has been release - works with the same ebuild out of the box for me)
Comment 7 Jana Saout 2014-09-29 10:42:44 UTC
Oh no... seems I was impatient.

[platform:Error] AssertionError: unrecognized function prologue - only supports push %ebp; movl %esp, %ebp

Still with 2.4.0. Where did you find the patch you are talking about?
Comment 8 Justin Lecher (RETIRED) gentoo-dev 2014-09-29 10:57:06 UTC
(In reply to Jana Saout from comment #7)
> Still with 2.4.0. Where did you find the patch you are talking about?

https://mail.python.org/pipermail/pypy-issue/2014-May/005127.html

and other commits if you are searching for problems with pypy and gcc-4.9.
Comment 9 Jana Saout 2014-09-29 11:19:46 UTC
Ah, I believe that was a different bug and was already fixed in 2.3.1.

Is it possible to get the assembler source file that causes the problem? They are autogenerated during the translation process and should be found in

/var/tmp/portage/dev-python/pypy-2.4.0/temp/usession-release-2.4.0-current/testing_1

(the ones with the .s ending - one of the function realigns the stack using an "and ...%rsp" if this is the same issue I am seeing. Something which isn't supported or handled if I am correctly informed)

gcc 4.8 doesn't attempt the stack alignment but uses potential unaligned 256-bit AVX registers on the stack instead.
Comment 10 Jana Saout 2014-09-29 14:37:16 UTC
Here it is:

leto:/var/tmp/portage/dev-python/pypy-2.4.0/temp/usession-release-2.4.0-current/testing_1 # grep 'and.*rsp' implement.s
	andq	$-32, %rsp


(in my case implement.s, you can find it in that directory just afther the translation fails)



The problematic function prologue looks like this:

.LFE166:
        .size   pypy_g_dispatcher_2, .-pypy_g_dispatcher_2
        .section        .text.unlikely
.LCOLDE32:
        .text
.LHOTE32:
        .section        .text.unlikely
.LCOLDB33:
        .text
.LHOTB33:
        .p2align 4,,15
        .globl  pypy_g_ll_join_chars_look_inside_iff__Signed_arrayPtr_P
        .type   pypy_g_ll_join_chars_look_inside_iff__Signed_arrayPtr_P, @function
pypy_g_ll_join_chars_look_inside_iff__Signed_arrayPtr_P:
.LFB167:
        .cfi_startproc
        leaq    8(%rsp), %r10
        .cfi_def_cfa 10, 0
        andq    $-32, %rsp
        pushq   -8(%r10)
        pushq   %rbp
        .cfi_escape 0x10,0x6,0x2,0x76,0
        movq    %rsp, %rbp
        pushq   %r12
        .cfi_escape 0x10,0xc,0x2,0x76,0x78
Comment 11 Justin Lecher (RETIRED) gentoo-dev 2014-11-10 08:28:42 UTC
Same with pypy-2.4.0
Comment 12 Alex Xu (Hello71) 2016-01-15 15:41:57 UTC
*** Bug 568698 has been marked as a duplicate of this bug. ***
Comment 13 Alex Xu (Hello71) 2016-01-15 15:48:15 UTC
reported fixed upstream 2014-05-12, probably in pypy 4 or greater, please test.
Comment 14 Jason Schulz 2016-01-15 18:47:12 UTC
I'm not sure this is the same bug as the two other bug reports.  I attached build logs to both the pypy and pypy3 bugs for anyone curious.  I provided links to the corresponding pypy bug reports as well.

I submitted a pull request that resolves this on github (https://github.com/gentoo/gentoo/pull/534), however the pull request wasn't accepted.

For anyone else experiencing this issue, the simplest solution is most likely using USE=shadowstack, which may or may not perform as well as asmgcroot if GC performance is an issue (http://pypy.readthedocs.org/en/latest/config/translation.gcrootfinder.html).