https://bugs.winehq.org/show_bug.cgi?id=49191
Bug ID: 49191 Summary: armv7l build broken: dlls/ntdll expression too complex Product: Wine Version: 5.6 Hardware: x86 OS: Linux Status: NEW Keywords: download, regression, source Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: austinenglish@gmail.com Regression SHA1: 39e4b788d6ca7d1e1ad045059ec7d088fde8a0db Distribution: Debian
gcc -c -o large_int.o large_int.c -I. -I../../include -D__WINESRC__ -D_NTSYSTEM_ -D_REENTRANT -fPIC -Wall \ -pipe -fcf-protection=none -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement \ -Wempty-body -Wignored-qualifiers -Wno-packed-not-aligned -Wshift-overflow=2 -Wstrict-prototypes \ -Wtype-limits -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op \ -gdwarf-2 -gstrict-dwarf -g -O2 -marm -mfloat-abi=hard {standard input}: Assembler messages: {standard input}:23: Error: expression too complex -- `push %ebx' {standard input}:25: Error: bad register expression {standard input}:26: Error: expression too complex -- `push %esi' {standard input}:28: Error: bad register expression {standard input}:29: Error: bad instruction `movl 12(%esp),%esi' {standard input}:30: Error: bad instruction `movl 16(%esp),%ebx' {standard input}:31: Error: bad instruction `movl 20(%esp),%ecx' {standard input}:32: Error: bad instruction `movl 24(%esp),%eax' {standard input}:33: Error: bad instruction `movl 28(%esp),%edx' {standard input}:34: Error: bad instruction `lock' {standard input}:34: Error: bad instruction `cmpxchg8b (%esi)' {standard input}:35: Error: expression too complex -- `pop %esi' {standard input}:36: Error: bad register expression {standard input}:38: Error: expression too complex -- `pop %ebx' {standard input}:39: Error: bad register expression {standard input}:41: Error: bad instruction `ret $20' make: *** [Makefile:432: large_int.o] Error 1
pi@raspberrypi:~/wine-git/dlls/ntdll $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/8/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Raspbian 8.3.0-6+rpi1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 8.3.0 (Raspbian 8.3.0-6+rpi1)
pi@raspberrypi:~/wine-git/dlls/ntdll $ as -v GNU assembler version 2.31.1 (arm-linux-gnueabihf) using BFD version (GNU Binutils for Raspbian) 2.31.1
pi@raspberrypi:~/wine-git/dlls/ntdll $ ld -v GNU ld (GNU Binutils for Raspbian) 2.31.1
39e4b788d6ca7d1e1ad045059ec7d088fde8a0db is the first bad commit commit 39e4b788d6ca7d1e1ad045059ec7d088fde8a0db Author: Alexandre Julliard julliard@winehq.org Date: Sat May 2 15:10:04 2020 +0200
ntdll: Use the standard Interlocked* functions.
Signed-off-by: Alexandre Julliard julliard@winehq.org
there's a similar regression in dlls/mf (and probably elsewhere): /usr/bin/ld: topology.o: in function `topology_generate_id': /home/pi/wine-bisect/dlls/mf/topology.c:871: undefined reference to `InterlockedCompareExchange64' /usr/bin/ld: mf.dll.so: hidden symbol `InterlockedCompareExchange64' isn't defined /usr/bin/ld: final link failed: bad value
didn't bisect it yet, but I suspect commit 5d5b6a1f35c6fee51dcef60818028061f03ce0ce.
interestingly, my other armv7l machine (PrawnOS), doesn't show this, with same gcc/ld versions (didn't compare flags closely though).
https://bugs.winehq.org/show_bug.cgi?id=49191
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- We need compiler support for interlocked functions. My first guess would be that --with-arch=armv6 in the compiler specs is the issue.
https://bugs.winehq.org/show_bug.cgi?id=49191
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello Austin,
could you run the following:
--- snip --- $ gcc -march=armv6 -dM -E - < /dev/null --- snip ---
--- snip --- $ gcc -march=armv6k -dM -E - < /dev/null --- snip ---
Grep for '__GCC_HAVE_SYNC_COMPARE_AND_SWAP', it should show the difference. Generally, atomics should be supported on ARMv6 architectures - but not all sizes. ARM supports 8-byte atomics with cmpxchg64 from ARMv6k onwards.
I guess your "failing" machine is a first-gen ARM11-based Raspberry Pi? That RPI ARM core is an ARM1176jzf-S which *supports* ARMv6k, including 8-byte atomics. The toolchain default '-march=armv6' is an unnecessarily limiting choice here.
Regards
https://bugs.winehq.org/show_bug.cgi?id=49191
--- Comment #3 from Austin English austinenglish@gmail.com --- Yeah, failing device is a raspberry pi 2b: pi@raspberrypi:~ $ cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 5 (v7l) BogoMIPS : 57.60 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xc07 CPU revision : 5 ... Hardware : BCM2835 Revision : a21041 Serial : 00000000a4ec119c Model : Raspberry Pi 2 Model B Rev 1.1
pi@raspberrypi:~ $ gcc -march=armv6 -dM -E - < /dev/null | grep __GCC_HAVE_SYNC_COMPARE_AND_SWAP #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
pi@raspberrypi:~ $ gcc -march=armv6k -dM -E - < /dev/null | grep __GCC_HAVE_SYNC_COMPARE_AND_SWAP #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
working device is a chromebook c201p, using PrawnOS (debian buster with no non-free components). gcc -v shows `--with-arch=armv7-a`.
I take it the solution is to build a custom gcc/clang with a different default arch? And to have a configure check to enforce that?
https://bugs.winehq.org/show_bug.cgi?id=49191
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|armv7l build broken: |armv7l build broken: |dlls/ntdll expression too |dlls/ntdll expression too |complex |complex (compiler default | |'-march=armv6' doesn't | |support | |__sync_add_and_fetch for | |64-bit integers) Hardware|x86 |arm
--- Comment #4 from Anastasius Focht focht@gmx.net --- Hello Austin,
--- quote --- I take it the solution is to build a custom gcc/clang with a different default arch? --- quote ---
I don't think rebuilding the entire toolchain with different default march 'armv6k' or 'armv7' is required/justified here. An alternative is to pass/export '-march=armv6k' or 'armv7' in CFLAGS when running configure since your target CPU does support this instruction set.
https://www.raspberrypi.org/forums/viewtopic.php?t=4256&start=250
--- quote --- And to have a configure check to enforce that? --- quote ---
Yes, it probably makes sense to have a configure check in place. If the compiler doesn't support __sync_add_and_fetch for 64-bit integers it should just bail. Providing an own, slow implementation like other projects do isn't worth the hassle.
https://github.com/mesa3d/mesa/commit/a6a38a03
Regards
https://bugs.winehq.org/show_bug.cgi?id=49191
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED Fixed by SHA1| |e055a3ee0503a62d1d0c1391b01 | |471c13fad6bd3
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- This should be fixed by e055a3ee0503a62d1d0c1391b01471c13fad6bd3.
https://bugs.winehq.org/show_bug.cgi?id=49191
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.0-rc2.
https://bugs.winehq.org/show_bug.cgi?id=49191
--- Comment #7 from Austin English austinenglish@gmail.com --- (In reply to Alexandre Julliard from comment #5)
This should be fixed by e055a3ee0503a62d1d0c1391b01471c13fad6bd3.
Yep, configure now detects it and I see -march=armv7-a in CFLAGS. Thanks!