[Bug 33349] Use Thumb binaries on ARM?

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Apr 14 10:47:40 CDT 2013


http://bugs.winehq.org/show_bug.cgi?id=33349

--- Comment #3 from Anastasius Focht <focht at gmx.net> 2013-04-14 10:47:40 CDT ---
Hello André,

--- quote ---
That's one of those things -mthumb-interwork is for and it doesn't increase the
size of the binaries, so to be sure i'd rather use it.
--- quote ---

Adding "-mthumb-interwork" to CFLAGS (CFLAGS="$CFLAGS -mthumb
-mthumb-interwork") doesn't change anything (clean rebuild), there is no veneer
inserted to switch to arm mode.

--- snip ---
$ winedbg --gdb ./miranda32.exe
...
Program received signal SIGSEGV, Segmentation fault.
0x404dc7ac in raise_exception (rec=0x0, context=0x0, first_chance=1087831368)
at /home/linaro/wine/wine-git/dlls/ntdll/signal_arm.c:530
530                 TRACE(" r4:%04x r5:%04x  r6:%04x  r7:%04x r8:%04x r9:%04x
r10:%04x Fp:%04x Ip:%04x\n",
Wine-gdb> bt
#0  0x404dc7ac in raise_exception (rec=0x0, context=0x0,
first_chance=1087831368) at
/home/linaro/wine/wine-git/dlls/ntdll/signal_arm.c:530
#1  0x40a81b76 in RaiseException (code=2147483904, flags=1, nbargs=2,
args=0x40d6fda8) at /home/linaro/wine/wine-git/dlls/kernel32/except.c:84
#2  0x4185a02e in __wine_spec_unimplemented_stub (module=0x4185a036
"msvcr110.dll", function=0x4185db3d "__crtGetShowWindowMode") at
/home/linaro/wine/wine-git/dlls/winecrt0/stub.c:34
#3  0x41857e5c in __wine_stub___crtGetShowWindowMode () from
/home/linaro/wine/wine-install/bin/../lib/wine/msvcr110.dll.so
#4  0x41857e5c in __wine_stub___crtGetShowWindowMode () from
/home/linaro/wine/wine-install/bin/../lib/wine/msvcr110.dll.so
--- snip ---

Disassembly is the same as posted in my comment #1

--- quote ---
Further RtlCaptureContext needs to be ARM or Thumb-2 because of the
instructions used, but as long as possible i also want to support older ARM
chips at least for winelib. So i choose to use ARM assembler for such functions
(same for relay logging, which actually only works with -marm)
--- quote ---

Exactly, older pre-ARMv7 (not counting ARMv6-T2) will only run winelib apps.
No Win32 ARM PE applications created by Microsoft compilers will ever run on
these (ARMv7 + Thumb-2 is minimum profile for target).
Well, maybe if mingw-w64-arm catches up someday and open source applications
are recompiled to arm code - though the usefulness remains doubtful.

I don't see a problem here with RtlCaptureContext() being Thumb-2.
The assembly instructions you used are valid for Thumb-2.

Removing ".arm" directive results in following Thumb-2 code:

--- snip ---
Wine-gdb> disas RtlCaptureContext
   0x40291050 <+0>:     str.w   r1, [sp, #-4]!
   0x40291054 <+4>:     mov.w   r1, #64 ; 0x40
   0x40291058 <+8>:     add.w   r1, r1, #3
   0x4029105c <+12>:    str     r1, [r0, #0]
   0x4029105e <+14>:    pop     {r1}
   0x40291060 <+16>:    str     r0, [r0, #4]
   0x40291062 <+18>:    str     r1, [r0, #8]
   0x40291064 <+20>:    str     r2, [r0, #12]
   0x40291066 <+22>:    str     r3, [r0, #16]
   0x40291068 <+24>:    str     r4, [r0, #20]
   0x4029106a <+26>:    str     r5, [r0, #24]
   0x4029106c <+28>:    str     r6, [r0, #28]
   0x4029106e <+30>:    str     r7, [r0, #32]
   0x40291070 <+32>:    str.w   r8, [r0, #36]   ; 0x24
   0x40291074 <+36>:    str.w   r9, [r0, #40]   ; 0x28
   0x40291078 <+40>:    str.w   r10, [r0, #44]  ; 0x2c
   0x4029107c <+44>:    str.w   r11, [r0, #48]  ; 0x30
   0x40291080 <+48>:    str.w   r12, [r0, #52]  ; 0x34
   0x40291084 <+52>:    str.w   sp, [r0, #56]   ; 0x38
   0x40291088 <+56>:    str.w   lr, [r0, #60]   ; 0x3c
   0x4029108c <+60>:    str.w   lr, [r0, #64]   ; 0x40
   0x40291090 <+64>:    mrs     r1, CPSR
   0x40291094 <+68>:    str     r1, [r0, #68]   ; 0x44
   0x40291096 <+70>:    mov     pc, lr
   0x40291098 <+72>:    nop.w
   0x4029109c <+76>:    nop.w
--- snip ---

The exception is properly raised:

--- snip ---
$ wine ./miranda32.exe 
wine: Call from 0x403956ff to unimplemented function
msvcr110.dll.__crtGetShowWindowMode, aborting
wine: Unimplemented function msvcr110.dll.__crtGetShowWindowMode called at
address 0x403956ff (thread 002a), starting debugger...
--- snip ---

Regards

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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