Instruction set
For iOS, each generation of devices has its own instruction set.
Instruction set | equipment |
---|---|
armv6 | IPhone, iPhone2, iPhone3G |
armv7 | iPhone 3GS, iPhone 4, iPhone 4S, |
armv7s | The iphone iPhone5C |
arm64/armv8 | IPhone 5S, iPhone6 (Plus), iPhone6s(Plus), iPhone7(Plus), iPhone8(Plus), iPhoneX |
The machine’s instruction set is all backwards compatible, so the armv7 instruction set can run on the iPhone5s, just not as efficiently.
Configuration in the iOS project
This is the Architectures option in the Build Setting
Architectures
Specify the instruction set supported by the APP, create a new project, its default option value isStandard architectures (armv7, arm64)
“, indicating that the APP only supportsarmv7
andarm64
Instruction set.Valid architectures
Option refers to the instruction set to be compiled. Default isArmv6, ARMV7, arm64
, indicating that the three instruction sets will be compiledBuild Active Architecture Only
Option indicates whether to compile the currently used instruction set. By default, this option is set to DebugYES
In order to be more efficient and fast debugging program; Set to in the Release caseNO
So that the APP can run on each machine with the highest efficiency. Because in theValid architectures
The instruction set set isArmv6, ARMV7, arm64
Under Release, the corresponding code is compiled for each instruction set, so the final IPA file size is roughly tripled.
conclusion
In most cases, the actual cross-compilation process only needs to compile the armV7 and ARM64 libraries, because the armv7 to ARMV7s instruction set changes are relatively small, and armV7s devices are not very many, and can be run with ARMV7. Arm64 has a lot of changes and a lot of devices, so it needs to be compiled separately to ensure the high quality of these devices.
Note:
The iOS emulator does not run the ARM instruction set; compilation runs on the x86 instruction set, so only on iOS devices will execute the arm instruction set corresponding to the device.