Is there a way to turn off GCC_THUMB_SUPPORT mode for sections of code or a module only rather than switching the entire application to ARM mode?
1 Answers
In Xcode 3, you can follow the process described by Paul in his answer here to set per-file build settings. Using that, you can add a custom setting to not use Thumb support for a file.
Xcode 4 moves these per-file configuration options. Joshua Nozzi describes where they end up in his short article here. Basically, they're now under the Build Phases tab within the project settings, under the Compile Sources grouping.
Be aware, however, that turning off building for Thumb is only recommended for the non-ARMv7 devices. Building using the Thumb2 instruction set in the ARMv7 devices (the iPhone 3G S and newer) is recommended in almost all cases. The Thumb instruction set can lead to a smaller binary, and it only slows down floating-point-heavy calculations on the older ARMv6 devices, not the overwhelming majority of hardware out there right now.

- 1
- 1

- 170,088
- 45
- 397
- 571
-
I am working on calculation code where every clock cycle counts. I do need to consider the device version issues, as you mentioned. Thanks! – martin's Apr 02 '11 at 19:57
-
1@Joe - For ARMv7 devices, I've not seen a case where turning Thumb-2 instructions off is recommended. If you watch the performance tuning (and I believe OpenGL ES) videos that you can access through the iOS Dev Center, the engineers at Apple pretty much recommend that you always build for Thumb on the newer devices. This can be done using conditional build settings, so that ARMv6 has Thumb off and ARMv7 has it on, because you are building a fat binary when supporting the older hardware. – Brad Larson Apr 02 '11 at 21:00
-
1FWIW, with Xcode 4.3, Apple seems to turn off Thumb for all architectures (GCCC_THUMB_SUPPORT = NO) when it upgrades project files. I don't know what to make of that ... – smparkes Feb 16 '12 at 19:47
-
Worth reading: http://stackoverflow.com/questions/8390606/is-there-a-way-to-compile-for-arm-rather-than-thumb-in-xcode-4 – Johannes Rudolph Mar 12 '12 at 13:56