[Bug 30134] Wine on ARM: .init/.text sections passed to assembler need directives to allow for mixed/pure arm32/thumb2 builds (.init section thumb2 libc ctors vs. Wine arm32 ctor)

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Mar 28 17:22:49 CDT 2012


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

--- Comment #5 from Anastasius Focht <focht at gmx.net> 2012-03-28 17:22:49 CDT ---
Hello André,

your patch is what I basically did to get Wine working with thumb2 userlands
;-)

--- quote ---
* forward -marm to the assembler, but sadly the linaro as only has -mthumb
option!?
--- quote ---

The assembler will compile in arm mode unless it is told to use thumb mode.
It's the toolchain (compiler) default that can be "-mthumb" but usually not the
assembler that was built as part of binutils.
One exception can be binutils/toolchains that target Thumb-only processors like
cortex M3.

--- quote ---
* use something like __attribute__((__arm__)) in WINAPI, but sadly gcc doesn't
have an attribute to define arm/thumb per function...
--- quote ---

For inline assembly you can always control this by emitting directives like
.thumb_func (unified syntax).
For pure C code I don't see a need for this.
The compiler/linker will take care of everything, generate code for arm<->thumb
switches where needed (branch with instruction set change/interworking
veneers).

To handle the special case of arm vs. thumb crti/crtn.o in .init section you
could use "__thumb2__" when you want to emit the snippet with thumb2-only
"b.w".
Toolchains that default to "thumb2" define it:

--- snip ---
linaro at linaro-ubuntu-desktop:~$ gcc -dM -E - < /dev/null | grep thumb
#define __thumb2__ 1
#define __thumb__ 1
--- snip ---

When not defined use arm 32 bit branch as of now.
The thumb1 case (<armv7/armv6t2) can be handled later if really needed.

The "blx" in "wine_call_on_stack" is fine.
No one really wants to build/run Wine on pre-armv5 targets.

--- quote ---
not sure if something like CPU_THUMB is nice to see in winebuild?
--- quote ---

Where do you need that? I think CPU_ARM should be enough for now.
There are several ways to determine/handle instruction set/mode switches where
needed.

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