https://bugs.winehq.org/show_bug.cgi?id=46079
Bug ID: 46079 Summary: Support 32-bit ARM hard-float cross-toolchains with GNU binutils assembler that doesn't implicitly assume '.fpu {vfp,neon}' (Yocto/Poky SDK) Product: Wine Version: 3.19 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: tools Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
after working around bug 46053 ("Support cross-toolchains that need target sysroot explicitly passed via ' --sysroot' command-line option (Yocto/Poky SDK)") by having 'winegcc' passing the target sysroot to the cross-compiler/linker via '--sysroot', aarch64 Wine now cross compiles successfully with a full target sysroot.
-> aarch64-poky-linux
------------------------------------------------------------------------- Build Configuration: BB_VERSION = "1.38.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "fedora-28" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "2.5.1" TUNE_FEATURES = "aarch64" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "sumo:d240b885f26e9b05c8db0364ab2ace9796709aad" meta-oe = "sumo:2bb21ef27c4b0c9d52d30b3b2c5a0160fd02b966" meta-clang = "sumo:1784b06e6b1a83748438b4bec7e079d735d5b608" ... -------------------------------------------------------------------------
Building for 32-bit ARMv7 hard-float fails (using the same mechanics).
-> arm-poky-linux-gnueabi (cortexa9hf-vfpv3-poky-linux-gnueabi)
------------------------------------------------------------------------- Build Configuration: BB_VERSION = "1.38.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "fedora-28" TARGET_SYS = "arm-poky-linux-gnueabi" MACHINE = "qemuarma9" DISTRO = "poky" DISTRO_VERSION = "2.5.1" TUNE_FEATURES = "arm armv7a vfp vfpv3d16 vfpv3 callconvention-hard cortexa9" TARGET_FPU = "hard" meta meta-poky meta-yocto-bsp = "sumo:d240b885f26e9b05c8db0364ab2ace9796709aad" meta-oe = "sumo:2bb21ef27c4b0c9d52d30b3b2c5a0160fd02b966" meta-clang = "sumo:1784b06e6b1a83748438b4bec7e079d735d5b608" ... -------------------------------------------------------------------------
--- snip --- ... /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -o d2d1.dll.so \ -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b \ arm-poky-linux-gnueabi -marm -mfloat-abi=hard -fasynchronous-unwind-tables -shared /home/focht/projects/wine/mainline-src/dlls/d2d1/d2d1.spec \ bitmap.o bitmap_render_target.o brush.o dc_render_target.o device.o effect.o factory.o geometry.o \ hwnd_render_target.o layer.o mesh.o state_block.o stroke.o wic_render_target.o version.res \ -ldwrite -ld3d10_1 ../../dlls/dxguid/libdxguid.a ../../dlls/uuid/libuuid.a -lgdi32 -luser32 \ -ladvapi32 ../../libs/port/libwine_port.a -Wb,-ddwrite -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed d2d1.IYX82U.s: Assembler messages: d2d1.IYX82U.s:291: Error: selected processor does not support `vpush {s0-s15}' in ARM mode d2d1.IYX82U.s:310: Error: selected processor does not support `vpush {s0-s15}' in ARM mode winebuild: arm-poky-linux-gnueabi-gcc failed with status 1 winegcc: /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild failed make[1]: *** [Makefile:1440: d2d1.dll.so] Error 2 make[1]: Leaving directory '/home/focht/projects/wine/mainline-build-arm/dlls/d2d1' make: *** [Makefile:8385: dlls/d2d1] Error 2 --- snip ---
Re-executing failing last command with '-v -save-temps':
--- snip --- /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -v -save-temps -o d2d1.dll.so -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b arm-poky-linux-gnueabi -marm -mfloat-abi=hard -fasynchronous-unwind-tables -shared /home/focht/projects/wine/mainline-src/dlls/d2d1/d2d1.spec bitmap.o bitmap_render_target.o brush.o dc_render_target.o device.o effect.o factory.o geometry.o hwnd_render_target.o layer.o mesh.o state_block.o stroke.o wic_render_target.o version.res -ldwrite -ld3d10_1 ../../dlls/dxguid/libdxguid.a ../../dlls/uuid/libuuid.a -lgdi32 -luser32 -ladvapi32 ../../libs/port/libwine_port.a -Wb,-ddwrite -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -v --save-temps --target arm-poky-linux-gnueabi -fasynchronous-unwind-tables --cc-cmd=arm-poky-linux-gnueabi-gcc --ld-cmd=arm-poky-linux-gnueabi-ld -D_REENTRANT -fPIC --dll -o d2d1.dll-IpMxH8.spec.o -E /home/focht/projects/wine/mainline-src/dlls/d2d1/d2d1.spec -L../../dlls -L../../libs/wine -marm -mfloat-abi=hard -ddwrite -rversion.res -- bitmap.o bitmap_render_target.o brush.o dc_render_target.o device.o effect.o factory.o geometry.o hwnd_render_target.o layer.o mesh.o state_block.o stroke.o wic_render_target.o ../../dlls/dwrite/libdwrite.def ../../dlls/d3d10_1/libd3d10_1.def ../../dlls/dxguid/libdxguid.a ../../dlls/uuid/libuuid.a ../../dlls/gdi32/libgdi32.def ../../dlls/user32/libuser32.def ../../dlls/advapi32/libadvapi32.def ../../libs/port/libwine_port.a ../../dlls/winecrt0/libwinecrt0.a ../../dlls/kernel32/libkernel32.def ../../dlls/ntdll/libntdll.def arm-poky-linux-gnueabi-gcc -xassembler -c -o d2d1.nY1v31.o d2d1.CJoop5.s arm-poky-linux-gnueabi-ld -r -o d2d1.KKS2kZ.o d2d1.nY1v31.o bitmap.o bitmap_render_target.o brush.o dc_render_target.o device.o effect.o factory.o geometry.o hwnd_render_target.o layer.o mesh.o state_block.o stroke.o wic_render_target.o ../../dlls/dxguid/libdxguid.a ../../dlls/uuid/libuuid.a ../../libs/port/libwine_port.a ../../dlls/winecrt0/libwinecrt0.a arm-poky-linux-gnueabi-gcc -xassembler -c -o d2d1.dll-IpMxH8.spec.o d2d1.vn7wK8.s d2d1.vn7wK8.s: Assembler messages: d2d1.vn7wK8.s:291: Error: selected processor does not support `vpush {s0-s15}' in ARM mode d2d1.vn7wK8.s:310: Error: selected processor does not support `vpush {s0-s15}' in ARM mode winebuild: arm-poky-linux-gnueabi-gcc failed with status 1 winegcc: /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild failed --- snip ---
$ cat d2d1.vn7wK8.s /* File generated automatically from /home/focht/projects/wine/mainline-src/dlls/d2d1/d2d1.spec; do not edit! */ /* This file can be copied, modified and distributed without restriction. */
.section ".text","ax" b 1f __wine_spec_pe_header: .skip 69632 1:
.data .align 2 .globl __wine_spec_nt_header .hidden __wine_spec_nt_header __wine_spec_nt_header: .L__wine_spec_rva_base: ... .L__wine_spec_exports_funcs: .long D2D1CreateFactory .long D2D1MakeRotateMatrix .long D2D1MakeSkewMatrix .long D2D1IsMatrixInvertible .long D2D1InvertMatrix .long __wine_stub_D2D1ConvertColorSpace .long __wine_stub_D2D1CreateDevice .long __wine_stub_D2D1CreateDeviceContext .long __wine_stub_D2D1SinCos .long __wine_stub_D2D1Tan .long __wine_stub_D2D1Vec3Length ... __wine_spec_relay_entry_points: nop .align 2 .L__wine_spec_relay_entry_point_1: .cfi_startproc push {r0-r3} mov r2, SP push {LR} sub SP, #4 mov r1,#393216 ldr r0, 2f add r0, PC ldr IP, [r0, #4] 1: blx IP ldr IP, [SP, #4] add SP, #24 bx IP 2: .long .L__wine_spec_relay_descr-1b .cfi_endproc .align 2 .L__wine_spec_relay_entry_point_2: .cfi_startproc push {r0-r3} mov r2, SP vpush {s0-s15} push {LR} sub SP, #4 mov r1,#1 add r1,#65536 ldr r0, 2f add r0, PC ldr IP, [r0, #4] 1: blx IP ldr IP, [SP, #4] add SP, #88 bx IP 2: .long .L__wine_spec_relay_descr-1b .cfi_endproc .align 2 --- snip ---
https://source.winehq.org/git/wine.git/blob/HEAD:/tools/winebuild/spec32.c#l...
--- snip --- ... case CPU_ARM: { unsigned int mask, val, count = 0; int j, has_float = 0;
if (strcmp( float_abi_option, "soft" )) for (j = 0; j < odp->u.func.nb_args && !has_float; j++) has_float = is_float_arg( odp, j );
val = (odp->u.func.args_str_offset << 16) | (i - spec->base); output( "\tpush {r0-r3}\n" ); output( "\tmov r2, SP\n"); if (has_float) output( "\tvpush {s0-s15}\n" ); output( "\tpush {LR}\n" ); output( "\tsub SP, #4\n"); for (mask = 0xff; mask; mask <<= 8) if (val & mask) output( "\t%s r1,#%u\n", count++ ? "add" : "mov", val & mask ); if (!count) output( "\tmov r1,#0\n" ); output( "\tldr r0, 2f\n"); output( "\tadd r0, PC\n"); output( "\tldr IP, [r0, #4]\n"); output( "1:\tblx IP\n"); output( "\tldr IP, [SP, #4]\n" ); output( "\tadd SP, #%u\n", 24 + (has_float ? 64 : 0) ); output( "\tbx IP\n"); output( "2:\t.long .L__wine_spec_relay_descr-1b\n" ); break; ... --- snip ---
The code was introduced by commit https://source.winehq.org/git/wine.git/commitdiff/5e3534ee411a8c5baea5022705... ("ntdll: Fix handling of floating point arguments in relay debugging on ARM.")
The problem is that Wine makes the assumption that the assembler from hardfloat binutils implicitly assumes '.fpu {vfp,neon}' without any command line options. This isn't necessarily true for most hard-float cross-toolchains but for native toolchains, running on actual targets. Usually this is solved by the cross-toolchain environment by passing the proper '-mfloat-abi=' and/or '-mfpu=' options when cross-compiling.
Simple test with .c file:
--- snip --- $ cat vfptest.c void foo(void){ __asm__ volatile("fadds s0, s0, s0"); } --- snip ---
--- snip --- $ arm-poky-linux-gnueabi-gcc -c vfptest.c /tmp/cc3DpeRI.s: Assembler messages: /tmp/cc3DpeRI.s:27: Error: selected processor does not support `fadds s0,s0,s0' in ARM mode
$ arm-poky-linux-gnueabi-gcc -mfloat-abi=hard -c vfptest.c --- snip ---
Test to show the available fpu target options:
--- snip --- $ arm-poky-linux-gnueabi-gcc -mfpu=? arm-poky-linux-gnueabi-gcc: error: unrecognized argument in option ‘-mfpu=?’
arm-poky-linux-gnueabi-gcc: note: valid arguments to ‘-mfpu=’ are: auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16
arm-poky-linux-gnueabi-gcc: fatal error: no input files compilation terminated. --- snip ---
Simple test with assembly file, illustrating the problem with Wine:
--- snip --- $ cat vfptest.S .text test: fadds s0, s0, s0 --- snip ---
NOTE: 'vfp' is an alias for 'vfpv2', 'neon' is an alias for 'neon-vfpv3'
--- snip --- $ arm-poky-linux-gnueabi-gcc -c vfptest.s vfptest.s: Assembler messages: vfptest.s:3: Error: selected processor does not support `fadds s0,s0,s0' in ARM mode
$ arm-poky-linux-gnueabi-gcc -c -mfloat-abi=hard vfptest.s vfptest.s: Assembler messages: vfptest.s:3: Error: selected processor does not support `fadds s0,s0,s0' in ARM mode
$ arm-poky-linux-gnueabi-gcc -c -mfpu=vfp vfptest.s $ arm-poky-linux-gnueabi-gcc -c -mfpu=vfpv2 vfptest.s $ arm-poky-linux-gnueabi-gcc -c -mfpu=vfpv3 vfptest.s $ arm-poky-linux-gnueabi-gcc -c -mfpu=vfpv4 vfptest.s $ arm-poky-linux-gnueabi-gcc -c -mfpu=neon vfptest.s ... --- snip ---
Unlike using C with inline assembly, real assembly sources need either '.fpu' directive, or '-mfpu=' option provided in the command line.
Using CFLAGS, EXTRACFLAGS to set '-mfpu=' doesn't work because of the 'winegcc' wrapper limitation (like bug 46053 it builds a custom command line, not passing these option down).
Forcing to a use hardfloat binutils with assembler that implicitly assumes '.fpu vfp' without any command line options is IMHO not feasible. I don't want to change/hack upstream toolchain projects.
Changing 'winebuild' to add explicit '.fpu vfp' or '.fpu neon' directives to the assembly sources in case of 32-bit ARM hard-float seems reasonable to me.
https://source.winehq.org/git/wine.git/blob/HEAD:/tools/winebuild/spec32.c
Simple test:
--- snip --- $ cat vfptest.s .fpu vfp .text test: fadds s0, s0, s0 --- snip ---
--- snip --- $ arm-poky-linux-gnueabi-gcc -c vfptest.s --- snip ---
With that problem fixed, Wine now cross compiles successfully with a full 32-bit ARM hardfloat target sysroot (same x11/freetype/libxml2 etc. deps as for my x86_64 host).
Next step would be running apps/tests on my x86_64 host with 'qemuarm64' and 'qemuarma9' using the generic ARM system emulation with the 'virt machine' machine which also supports 'virtio-gpu' for full graphics stack.
$ wine --version wine-3.19-117-g4852130c82
Regards
https://bugs.winehq.org/show_bug.cgi?id=46079
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.winehq.org/sho | |w_bug.cgi?id=46053
https://bugs.winehq.org/show_bug.cgi?id=46079
André H. nerv@dawncrow.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nerv@dawncrow.de
https://bugs.winehq.org/show_bug.cgi?id=46079
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
progress has been made:
https://source.winehq.org/git/wine.git/commitdiff/0fd533836b8cdea8b9a6af667b... ("winebuild: Pass the -mfpu option to the compiler/assembler.")
https://source.winehq.org/git/wine.git/commitdiff/a51611e816979390efe267d95d... ("winegcc: Forward the -mfpu option to winebuild.")
The autoconf part for '-mfpu' is missing though ('TARGETFLAGS' variable).
Regards
https://bugs.winehq.org/show_bug.cgi?id=46079
--- Comment #2 from Anastasius Focht focht@gmx.net --- Hello folks,
revisiting, still present.
--- snip --- ... arm-pokymllib32-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard --sysroot=/home/focht/projects/poky/sdk-install/sysroots/aarch64-poky-linux -c -o wcs.o /home/focht/projects/wine/mainline-src/dlls/crtdll/../msvcrt/wcs.c -I. \ -I/home/focht/projects/wine/mainline-src/dlls/crtdll \ -I/home/focht/projects/wine/mainline-src/dlls/crtdll/../msvcrt -I../../include \ -I/home/focht/projects/wine/mainline-src/include -D__WINESRC__ -D_MT -D_MSVCR_VER=0 -D_CRTDLL \ -D_REENTRANT -fPIC -Wall -pipe -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 /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -o crtdll.dll.so \ -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b \ arm-pokymllib32-linux-gnueabi -marm -mfloat-abi=hard -fPIC -fasynchronous-unwind-tables -shared \ /home/focht/projects/wine/mainline-src/dlls/crtdll/crtdll.spec console.o cpp.o ctype.o data.o \ dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o exit.o \ file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o thread.o \ time.o undname.o wcs.o -ladvapi32 -luser32 ../../libs/port/libwine_port.a -Wb,-dadvapi32 \ -Wb,-duser32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed crtdll.wx3SpG.s: Assembler messages: crtdll.wx3SpG.s:3253: Error: selected processor does not support `vpush {s0-s15}' in ARM mode crtdll.wx3SpG.s:3398: Error: selected processor does not support `vpush {s0-s15}' in ARM mode --- snip ---
More verbose
--- snip --- $ cd /home/focht/projects/wine/mainline-build-arm/dlls/crtdll
/home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -v -o crtdll.dll.so -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b arm-pokymllib32-linux-gnueabi -marm -mfloat-abi=hard -fPIC -fasynchronous-unwind-tables -shared /home/focht/projects/wine/mainline-src/dlls/crtdll/crtdll.spec console.o cpp.o ctype.o data.o dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o exit.o file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o thread.o time.o undname.o wcs.o -ladvapi32 -luser32 ../../libs/port/libwine_port.a -Wb,-dadvapi32 -Wb,-duser32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -v --target arm-pokymllib32-linux-gnueabi -munix -fasynchronous-unwind-tables --cc-cmd=arm-pokymllib32-linux-gnueabi-gcc --ld-cmd=arm-pokymllib32-linux-gnueabi-ld -D_REENTRANT -fPIC --dll -o crtdll.dll-3bZX0K.spec.o -E /home/focht/projects/wine/mainline-src/dlls/crtdll/crtdll.spec -L../../dlls -L../../libs/wine -marm -mfloat-abi=hard -dadvapi32 -duser32 -- console.o cpp.o ctype.o data.o dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o exit.o file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o thread.o time.o undname.o wcs.o ../../dlls/advapi32/libadvapi32.def ../../dlls/user32/libuser32.def ../../libs/port/libwine_port.a ../../dlls/winecrt0/libwinecrt0.a ../../dlls/kernel32/libkernel32.def ../../dlls/ntdll/libntdll.def arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -o crtdll.Ku8jzm.o crtdll.MKNemL.s arm-pokymllib32-linux-gnueabi-ld --no-wchar-size-warning -r -o crtdll.I4vdYV.o crtdll.Ku8jzm.o console.o cpp.o ctype.o data.o dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o exit.o file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o thread.o time.o undname.o wcs.o ../../libs/port/libwine_port.a ../../dlls/winecrt0/libwinecrt0.a /home/focht/projects/poky/sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-nm -u crtdll.I4vdYV.o arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -o crtdll.dll-3bZX0K.spec.o crtdll.kBlbDz.s crtdll.kBlbDz.s: Assembler messages: crtdll.kBlbDz.s:3253: Error: selected processor does not support `vpush {s0-s15}' in ARM mode crtdll.kBlbDz.s:3398: Error: selected processor does not support `vpush {s0-s15}' in ARM mode ... --- snip ---
NOTE: Workaround for bug 46053 applied prior to pass explicit target sysroot.
Passing 'mfpu=xxx' via CFLAGS won't work here, it doesn't get propagated into TARGETFLAGS as already mentioned in comment #1
Autogenerated Makefile:
--- snip --- ... CC = arm-pokymllib32-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard --sysroot=/home/focht/projects/poky/sdk-install/sysroots/aarch64-poky-linux CFLAGS = -g -O2 -mfpu=neon -marm -mfloat-abi=hard ... EXTRACFLAGS = -Wall -pipe -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 ... LD = arm-pokymllib32-linux-gnueabi-ld --sysroot=/home/focht/projects/poky/sdk-install/sysroots/aarch64-poky-linux ... LDFLAGS = -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed ... TARGETFLAGS = -b arm-pokymllib32-linux-gnueabi -marm -mfloat-abi=hard --- snip ---
With fixes applied:
--- snip --- ... /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -o crtdll.dll.so \ -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b \ arm-pokymllib32-linux-gnueabi -marm -mfloat-abi=hard -mfpu=neon -fPIC -fasynchronous-unwind-tables \ -shared /home/focht/projects/wine/mainline-src/dlls/crtdll/crtdll.spec console.o cpp.o ctype.o \ data.o dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o \ exit.o file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o \ thread.o time.o undname.o wcs.o -ladvapi32 -luser32 ../../libs/port/libwine_port.a -Wb,-dadvapi32 \ -Wb,-duser32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -o crtdll.dll.fake \ -B/home/focht/projects/wine/mainline-build-x86_64/tools/winebuild --sysroot=../.. -b \ arm-pokymllib32-linux-gnueabi -marm -mfloat-abi=hard -mfpu=neon -fPIC -fasynchronous-unwind-tables \ -shared /home/focht/projects/wine/mainline-src/dlls/crtdll/crtdll.spec console.o cpp.o ctype.o \ data.o dir.o environ.o errno.o except.o except_arm.o except_arm64.o except_i386.o except_x86_64.o \ exit.o file.o heap.o locale.o lock.o main.o math.o mbcs.o misc.o process.o scanf.o string.o \ thread.o time.o undname.o wcs.o -ladvapi32 -luser32 ../../libs/port/libwine_port.a -Wb,-dadvapi32 \ -Wb,-duser32 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed make[1]: Leaving directory '/home/focht/projects/wine/mainline-build-arm/dlls/crtdll' ... --- snip ---
$ wine --version wine-4.12.1
Regards
https://bugs.winehq.org/show_bug.cgi?id=46079
--- Comment #3 from Anastasius Focht focht@gmx.net --- Hello folks,
revisiting, still present. Still need to patch 'configure.ac' to add '--with-fpu=fpu' option for ARM hard-float toolchains (neon*|vfp*) in order to get fpu setting propagated via TARGETFLAGS.
$ wine --version wine-5.9
Regards
https://bugs.winehq.org/show_bug.cgi?id=46079
--- Comment #4 from Anastasius Focht focht@gmx.net --- Hello folks,
revisiting, still present.
With bug 33349 ("Add support for 32-bit ARM Thumb-2 Wine build") resolved recently, I was no longer able to build Wine on 32-bit ARM.
I figured out that even more compiler options "tunes" need to be passed via TARGETFLAGS hence I dropped the custom '--with-fpu' patch and replaced it with the ability to append to 'TARGETFLAGS' via 'EXTRA_TARGETFLAGS'.
--- snip --- ... /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -o dlls/acledit/acledit.dll.so --wine-objdir . \ --winebuild /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -b \ arm-pokymllib32-linux-gnueabi -mthumb -mfloat-abi=hard -mfpu=neon -fPIC \ -fasynchronous-unwind-tables -shared \ /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec -mno-cygwin dlls/acledit/main.o \ dlls/ucrtbase/libucrtbase.a -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now acledit.eAw2TX.s: Assembler messages: acledit.eAw2TX.s:265: Error: cannot honor width suffix -- `mov r1,#3' acledit.eAw2TX.s:268: Error: cannot honor width suffix -- `ldr IP,[r0,#4]' acledit.eAw2TX.s:270: Error: cannot honor width suffix -- `ldr IP,[SP,#4]' acledit.eAw2TX.s:283: Error: cannot honor width suffix -- `mov r1,#4' acledit.eAw2TX.s:286: Error: cannot honor width suffix -- `ldr IP,[r0,#4]' acledit.eAw2TX.s:288: Error: cannot honor width suffix -- `ldr IP,[SP,#4]' acledit.eAw2TX.s:385: Error: cannot honor width suffix -- `ldr ip,2f' acledit.eAw2TX.s:387: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.eAw2TX.s:399: Error: cannot honor width suffix -- `ldr ip,2f' acledit.eAw2TX.s:401: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.eAw2TX.s:413: Error: cannot honor width suffix -- `ldr ip,2f' acledit.eAw2TX.s:415: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.eAw2TX.s:427: Error: cannot honor width suffix -- `ldr ip,2f' acledit.eAw2TX.s:429: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.eAw2TX.s:441: Error: cannot honor width suffix -- `ldr ip,2f' acledit.eAw2TX.s:443: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.eAw2TX.s:8: Error: branch out of range acledit.eAw2TX.s:8: Error: value of 69630 too large for field of 2 bytes at 0 acledit.eAw2TX.s:266: Error: invalid offset, target not word aligned (0x0001108E) acledit.eAw2TX.s:266: Error: invalid offset, value too big (0x00000006) acledit.eAw2TX.s:284: Error: invalid offset, target not word aligned (0x000110A6) acledit.eAw2TX.s:284: Error: invalid offset, value too big (0x00000006) winebuild: /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc failed with status 1 winegcc: /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild failed make: *** [Makefile:1910: dlls/acledit/acledit.dll.so] Error 2 ... --- snip ---
Re-running the failing command with more verbosity and '-save-temps':
--- snip --- ... /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -v -save-temps -o dlls/acledit/acledit.dll.so --wine-objdir . --winebuild /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -b arm-pokymllib32-linux-gnueabi -mthumb -mfloat-abi=hard -mfpu=neon -fPIC -fasynchronous-unwind-tables -shared /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec -mno-cygwin dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -v --save-temps --target arm-pokymllib32-linux-gnueabi -mno-cygwin -fasynchronous-unwind-tables --cc-cmd=/home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc --ld-cmd=/home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-ld -D_REENTRANT -fPIC --dll -o acledit.dll-T0AWBb.spec.o -E /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec -L./dlls -L./libs/wine -mthumb -mfloat-abi=hard -mfpu=neon -mno-cygwin -- dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a ./dlls/winecrt0/libwinecrt0.a dlls/ucrtbase/libucrtbase.a ./dlls/kernel32/libkernel32.def ./dlls/ntdll/libntdll.def /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -mfpu=neon -o acledit.KiCrAb.o acledit.y5oYRa.s /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-ld --no-wchar-size-warning -r -o acledit.GxGPFb.o acledit.KiCrAb.o dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a ./dlls/winecrt0/libwinecrt0.a dlls/ucrtbase/libucrtbase.a /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-nm -u acledit.GxGPFb.o /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -mfpu=neon -o acledit.dll-T0AWBb.spec.o acledit.0YgObc.s acledit.0YgObc.s: Assembler messages: acledit.0YgObc.s:265: Error: cannot honor width suffix -- `mov r1,#3' acledit.0YgObc.s:268: Error: cannot honor width suffix -- `ldr IP,[r0,#4]' acledit.0YgObc.s:270: Error: cannot honor width suffix -- `ldr IP,[SP,#4]' acledit.0YgObc.s:283: Error: cannot honor width suffix -- `mov r1,#4' acledit.0YgObc.s:286: Error: cannot honor width suffix -- `ldr IP,[r0,#4]' acledit.0YgObc.s:288: Error: cannot honor width suffix -- `ldr IP,[SP,#4]' acledit.0YgObc.s:385: Error: cannot honor width suffix -- `ldr ip,2f' acledit.0YgObc.s:387: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.0YgObc.s:399: Error: cannot honor width suffix -- `ldr ip,2f' acledit.0YgObc.s:401: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.0YgObc.s:413: Error: cannot honor width suffix -- `ldr ip,2f' acledit.0YgObc.s:415: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.0YgObc.s:427: Error: cannot honor width suffix -- `ldr ip,2f' acledit.0YgObc.s:429: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.0YgObc.s:441: Error: cannot honor width suffix -- `ldr ip,2f' acledit.0YgObc.s:443: Error: cannot honor width suffix -- `ldr pc,[ip]' acledit.0YgObc.s:8: Error: branch out of range acledit.0YgObc.s:8: Error: value of 69630 too large for field of 2 bytes at 0 acledit.0YgObc.s:266: Error: invalid offset, target not word aligned (0x0001108E) acledit.0YgObc.s:266: Error: invalid offset, value too big (0x00000006) acledit.0YgObc.s:284: Error: invalid offset, target not word aligned (0x000110A6) acledit.0YgObc.s:284: Error: invalid offset, value too big (0x00000006) winebuild: /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc failed with status 1 winegcc: /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild failed ... --- snip ---
'acledit.0YgObc.s'
--- snip --- /* File generated automatically from /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec; do not edit! */ /* This file can be copied, modified and distributed without restriction. */
.syntax unified .thumb
.section ".text","ax" b 1f __wine_spec_pe_header: .skip 69632 1:
.data .align 2 .globl __wine_spec_nt_header __wine_spec_nt_header: .L__wine_spec_rva_base: .long 0x4550 .short 0x01c4 .short 0 .long 997307161 .long 0 .long 0 .short 224 .short 0x2022 ... __wine_spec_relay_entry_points: nop .align 2 .thumb_func .L__wine_spec_relay_entry_point_4: .cfi_startproc push {r0-r3} mov r2, SP push {LR} sub SP, #4 mov r1,#3 ldr r0, 2f 1: add r0, PC ldr IP, [r0, #4] blx IP ldr IP, [SP, #4] add SP, #24 bx IP --- snip ---
All these errors are sign of a general problem. The cross-toolchain has conservative builtin default "tunes":
--- snip --- $ arm-pokymllib32-linux-gnueabi-gcc -Q --help=target The following options are target specific: -mabi= aapcs-linux -mabort-on-noreturn [disabled] -mandroid [disabled] -mapcs [disabled] -mapcs-frame [disabled] -mapcs-reentrant [disabled] -mapcs-stack-check [disabled] -march= armv5t -marm [enabled] -masm-syntax-unified [disabled] -mbe32 [enabled] -mbe8 [disabled] -mbig-endian [disabled] -mbionic [disabled] -mbranch-cost= -1 -mcallee-super-interworking [disabled] -mcaller-super-interworking [disabled] -mcmse [disabled] -mcpu= arm10tdmi -mfix-cortex-m3-ldrd [disabled] -mflip-thumb [disabled] -mfloat-abi= soft -mfp16-format= none -mfpu= auto -mgeneral-regs-only [disabled] -mglibc [enabled] -mhard-float -mlittle-endian [enabled] -mlong-calls [disabled] -mmusl [disabled] -mneon-for-64bits [disabled] -mpic-data-is-text-relative [enabled] -mpic-register= -mpoke-function-name [disabled] -mprint-tune-info [disabled] -mpure-code [disabled] -mrestrict-it [disabled] -msched-prolog [enabled] -msingle-pic-base [disabled] -mslow-flash-data [disabled] -msoft-float -mstructure-size-boundary= 8 -mthumb [disabled] -mthumb-interwork [disabled] -mtls-dialect= gnu -mtp= soft -mtpcs-frame [disabled] -mtpcs-leaf-frame [disabled] -mtune= -muclibc [disabled] -munaligned-access [disabled] -mvectorize-with-neon-double [disabled] -mvectorize-with-neon-quad [enabled] -mword-relocations [enabled]
Known ARM ABIs (for use with the -mabi= option): aapcs aapcs-linux apcs-gnu atpcs iwmmxt
Known __fp16 formats (for use with the -mfp16-format= option): alternative ieee none
Known ARM FPUs (for use with the -mfpu= option): auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16
Valid arguments to -mtp=: auto cp15 soft
Known floating-point ABIs (for use with the -mfloat-abi= option): hard soft softfp
TLS dialect to use: gnu gnu2 --- snip ---
Normally this wouldn't be a problem because the cross-toolchain environment always passes the proper "tunes" via environment variables.
--- snip --- $ printenv | grep CC
CLANGCC=arm-pokymllib32-linux-gnueabi-clang -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -mlittle-endian --sysroot=/home/focht/projects/poky-sdk-install/sysroots/aarch64-poky-linux
CC=arm-pokymllib32-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/focht/projects/poky-sdk-install/sysroots/aarch64-poky-linux
... --- snip ---
In case of Winebuild the command line is manually constructed. If gcc doesn't get '-march=' or '-mcpu=' then unified assembler syntax won't work for "builtin" '-march=armv5t' default.
The only Thumb encodings for (non-flag-setting) mov with an immediate operand are 32-bit ones. Older ARM processors doesn't support those, so the assembler ends up choking on its own constraints. In unified assembler language one has to explicitly use 'movs' to get the only "move immediate" instruction.
https://developer.arm.com/documentation/ddi0432/c/programmers-model/instruct...
Wine generated makefile:
--- snip --- TARGETFLAGS = -b arm-pokymllib32-linux-gnueabi -mthumb -mfloat-abi=hard --- snip ---
https://source.winehq.org/git/wine.git/blob/a952453888fb5df3c70edf357820bc92...
--- snip --- 390 struct strarray get_as_command(void) 391 { 392 struct strarray args; 393 unsigned int i; 394 395 if (cc_command.count) 396 { 397 args = strarray_copy( cc_command ); 398 strarray_add( &args, "-xassembler", "-c", NULL ); 399 if (force_pointer_size) 400 strarray_add_one( &args, (force_pointer_size == 8) ? "-m64" : "-m32" ); 401 if (cpu_option) strarray_add_one( &args, strmake("-mcpu=%s", cpu_option) ); 402 if (fpu_option) strarray_add_one( &args, strmake("-mfpu=%s", fpu_option) ); 403 if (arch_option) strarray_add_one( &args, strmake("-march=%s", arch_option) ); 404 for (i = 0; i < tools_path.count; i++) 405 strarray_add_one( &args, strmake("-B%s", tools_path.str[i] )); 406 return args; 407 } 408 409 if (!as_command.count) 410 { 411 static const char * const commands[] = { "gas", "as", NULL }; 412 as_command = find_tool( "as", commands ); 413 } 414 415 args = strarray_copy( as_command ); 416 417 if (force_pointer_size) 418 { 419 switch (target_platform) 420 { 421 case PLATFORM_APPLE: 422 strarray_add( &args, "-arch", (force_pointer_size == 8) ? "x86_64" : "i386", NULL ); 423 break; 424 default: 425 switch(target_cpu) 426 { 427 case CPU_POWERPC: 428 strarray_add_one( &args, (force_pointer_size == 8) ? "-a64" : "-a32" ); 429 break; 430 default: 431 strarray_add_one( &args, (force_pointer_size == 8) ? "--64" : "--32" ); 432 break; 433 } 434 break; 435 } 436 } 437 438 if (cpu_option) strarray_add_one( &args, strmake("-mcpu=%s", cpu_option) ); 439 if (fpu_option) strarray_add_one( &args, strmake("-mfpu=%s", fpu_option) ); 440 return args; 441 } --- snip ---
After fixing this, the assembler command became: '... -xassembler -c -mfpu=neon -march=armv7ve ...') and it successfully linked the executables.
--- snip --- ... /home/focht/projects/wine/mainline-build-x86_64/tools/winegcc/winegcc -v -o dlls/acledit/acledit.dll.so --wine-objdir . --winebuild /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -b arm-pokymllib32-linux-gnueabi -march=armv7ve -mthumb -mfloat-abi=hard -mfpu=neon -fPIC -fasynchronous-unwind-tables -shared /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec -mno-cygwin dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -v --target arm-pokymllib32-linux-gnueabi -mno-cygwin -fasynchronous-unwind-tables --cc-cmd=/home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc --ld-cmd=/home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-ld -D_REENTRANT -fPIC --dll -o acledit.dll-kkATwS.spec.o -E /home/focht/projects/wine/mainline-src/dlls/acledit/acledit.spec -L./dlls -L./libs/wine -march=armv7ve -mthumb -mfloat-abi=hard -mfpu=neon -mno-cygwin -- dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a ./dlls/winecrt0/libwinecrt0.a dlls/ucrtbase/libucrtbase.a ./dlls/kernel32/libkernel32.def ./dlls/ntdll/libntdll.def /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -mfpu=neon -march=armv7ve -o acledit.wc9Dpz.o acledit.3sTEMR.s /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-ld --no-wchar-size-warning -r -o acledit.tn17rg.o acledit.wc9Dpz.o dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a ./dlls/winecrt0/libwinecrt0.a dlls/ucrtbase/libucrtbase.a /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-nm -u acledit.tn17rg.o /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -xassembler -c -mfpu=neon -march=armv7ve -o acledit.dll-kkATwS.spec.o acledit.SgX3JW.s Creating file try_link-06FY8C.c /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -mthumb -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -o try_link-0pznLn.out -Wl,-z,max-page-size=0x1000 try_link-06FY8C.c Creating file try_link-mbBDiR.c /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -mthumb -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -shared -Wl,-Bsymbolic -o try_link-MfODdA.out -Wl,-z,defs try_link-mbBDiR.c /home/focht/projects/poky-sdk-install/sysroots/x86_64-pokysdk-linux/usr/bin/arm-pokymllib32-linux-gnueabi/arm-pokymllib32-linux-gnueabi-gcc -mthumb -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -shared -Wl,-Bsymbolic -Wl,--no-wchar-size-warning --sysroot=/home/focht/projects/poky-sdk-install/sysroots/aarch64-poky-linux -o dlls/acledit/acledit.dll.so -L./dlls -L./libs/wine acledit.dll-kkATwS.spec.o dlls/acledit/main.o dlls/ucrtbase/libucrtbase.a ./dlls/winecrt0/libwinecrt0.a dlls/ucrtbase/libucrtbase.a -lm -lc /home/focht/projects/wine/mainline-build-x86_64/tools/winebuild/winebuild -v --target arm-pokymllib32-linux-gnueabi -mno-cygwin -fasynchronous-unwind-tables --fixup-ctors dlls/acledit/acledit.dll.so --- snip ---
$ wine --version wine-6.0-111-gf03db0f75e9
Regards