[arm] needs porting to thumb2

Bug #513732 reported by Alexander Sack on 2010-01-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gmp (Debian)
Confirmed
Unknown
gmp (Ubuntu)
High
Unassigned
Lucid
High
Unassigned

Bug Description

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

"uses mov; also "add" assumes arm"

Alexander Sack (asac) on 2010-01-28
tags: added: armel armv7
Changed in gmp (Ubuntu):
status: New → Triaged
importance: Undecided → High
Paul Larson (pwlars) on 2010-01-29
Changed in gmp (Ubuntu Lucid):
milestone: none → lucid-alpha-3
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
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

Alexander Sack (asac) on 2010-02-22
Changed in gmp (Ubuntu Lucid):
assignee: nobody → David Sugar (dyfet)
Steve Langasek (vorlon) on 2010-02-23
Changed in gmp (Ubuntu Lucid):
milestone: lucid-alpha-3 → ubuntu-10.04-beta-1

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

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

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.)

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.

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) on 2010-03-17
Changed in gmp (Ubuntu Lucid):
milestone: ubuntu-10.04-beta-1 → ubuntu-10.04-beta-2
Steve Langasek (vorlon) on 2010-04-08
Changed in gmp (Ubuntu Lucid):
milestone: ubuntu-10.04-beta-2 → ubuntu-10.04
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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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