[Bug 46079] Support 32-bit ARM hard-float cross-toolchains with GNU binutils assembler that doesn't implicitly assume '.fpu {vfp,neon}' (Yocto/Poky SDK)
WineHQ Bugzilla
wine-bugs at winehq.org
Thu Jan 21 16:45:52 CST 2021
https://bugs.winehq.org/show_bug.cgi?id=46079
--- Comment #4 from Anastasius Focht <focht at 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/instruction-set-summary
Wine generated makefile:
--- snip ---
TARGETFLAGS = -b arm-pokymllib32-linux-gnueabi -mthumb -mfloat-abi=hard
--- snip ---
https://source.winehq.org/git/wine.git/blob/a952453888fb5df3c70edf357820bc924b4f3e7f:/tools/winebuild/utils.c#l390
--- 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
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list