[arm] needs porting to thumb2

Bug #513732 reported by Alexander Sack
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gmp (Debian)
Fix Released
Unknown
gmp (Ubuntu)
Fix Released
High
Unassigned
Lucid
Fix Released
High
Unassigned

Bug Description

https://wiki.ubuntu.com/ARM/Thumb2PackageReviewList

"uses mov; also "add" assumes arm"

Tags: armel armv7
Alexander Sack (asac)
tags: added: armel armv7
Changed in gmp (Ubuntu):
status: New → Triaged
importance: Undecided → High
Paul Larson (pwlars)
Changed in gmp (Ubuntu Lucid):
milestone: none → lucid-alpha-3
Revision history for this message
Alexander Sack (asac) wrote :

identified during sprint:

17:23 < asac> 1. fix mov in the .asm files (special casing using m4)
17:24 < asac> 2. fix the invert_limb thing to use adr rather than add

3. if its easy, switch AS to -mthumb

Changed in gmp (Ubuntu Lucid):
assignee: nobody → David Sugar (dyfet)
assignee: David Sugar (dyfet) → nobody
Revision history for this message
Alexander Sack (asac) wrote :

dmart said:details about how to properly do 3. will land on the wiki page:
  https://wiki.ubuntu.com/ARM/Thumb2PortingHowto

Revision history for this message
Dave Martin (dave-martin-arm) wrote : RE: [Bug 513732] Re: [arm] needs porting to thumb2

Some info is now posted; see:

<https://wiki.ubuntu.com/ARM/Thumb2PortingHowto#Building%20Stand-Alone%20Ass
embler%20Files%20in%20Thumb-2>

Revision history for this message
Dave Martin (dave-martin-arm) wrote :
Alexander Sack (asac)
Changed in gmp (Ubuntu Lucid):
assignee: nobody → David Sugar (dyfet)
Steve Langasek (vorlon)
Changed in gmp (Ubuntu Lucid):
milestone: lucid-alpha-3 → ubuntu-10.04-beta-1
Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

I found a simpler way to patch this which leaves configure alone. The debdiff is attached.

Revision history for this message
David Sugar (dyfet-deactivatedaccount) wrote :

Opps, forgot to add the actual bug to the changelog ;). Revised patch....

Revision history for this message
Dave Martin (dave-martin-arm) wrote :

+ifneq (,$(findstring $(DEB_HOST_ARCH), armel))
+ CFLAGS += -Wa,--defsym,USES_THUMB=1
+endif

To avoid breaking things in Debian, I believe USES_THUMB should not be set for their armel target.

The best way might to be to see whether the compiler defaults to Thumb (which could be done via configure or in the Makefile).

This would work in the Makefile for example (though it's pretty ghastly):

ifneq (,$(findstring $(DEB_HOST_ARCH),armel))
CFLAGS += $(shell $(CC) -dM -E -xc /dev/null | grep -q __thumb__ && echo -Wa,--defsym,INTERWORKING_NEEDED=1)
endif

(CFLAGS is deliberately omitted from the CC command line here: if the toolchain _defaults_ to Thumb, we can expect to have to support interworking, even someone decides to add -marm for this package or specific files. I also renamed the symbol which gets defined to make the meaning a bit clearer; but obviously that's just cosmetic.)

Revision history for this message
Dave Martin (dave-martin-arm) wrote :

Talking to a Debian guy about the armel port, it sounds like armel is not expected to run on anything prior to ARMv4T.

So maybe the complexity in my above post isn't needed. However, Debian are pretty unlikely to use Thumb at all until/unless they move to ARMv5 or newer (since adding interworking support introduces some inefficiencies on ARMv4T). So it may still be best to avoid affecting any code generation on Debian for now in armel.

Revision history for this message
Loïc Minier (lool) wrote :

The CC test is fine and the right approach IMO; I used something similar in ffmpeg to check whether the compiler defaults to VFP, v6 etc.:
check_asm = $(shell echo 'void foo(void) { __asm__ volatile("$(1)"); }' | $(CC) -x c -c - -o /dev/null 2>/dev/null && echo 1 || echo 0)
vfp_asm := fadds s0, s0, s0
has_vfp := $(call check_asm, $(vfp_asm))
ifneq ($(has_vfp),1)
FLAVORS += vfp
endif

Steve Langasek (vorlon)
Changed in gmp (Ubuntu Lucid):
milestone: ubuntu-10.04-beta-1 → ubuntu-10.04-beta-2
Steve Langasek (vorlon)
Changed in gmp (Ubuntu Lucid):
milestone: ubuntu-10.04-beta-2 → ubuntu-10.04
Revision history for this message
Alexander Sack (asac) wrote :

was fixed a bit a go ... changelog had a typo in bug numbre ...

Changed in gmp (Ubuntu Lucid):
status: Triaged → Fix Released
Changed in gmp (Debian):
status: Unknown → Confirmed
Changed in gmp (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.