Trying to understand how the code is converted in ARM platform from code to binary. Are the gcc compilers used in the different ARM platforms (iOS, Android, Blackberry) the same compiler, except that the header and library files are different? Or are they totally different compilers?

  • 1
    iOS used to be mainly GCC, nowadays its LLVM+Clang. – ixje Sep 21 '13 at 8:42

While the "GCC compiler" may be the same software (generally speaking), the specific instances used for compiling code here and there can produce quite different output.

  1. when compiling GCC itself, you can set hundreds of options, many of them influencing the generated code.
  2. even after building the compiler, every specific compile may use additional options, such as the target chip or architecture level, or specific optimization settings, which will again change the output.
  3. in addition to the mainline, official GCC from GNU, there are various forks from different organizations: Linaro GCC, Apple GCC, CodeSourcery GCC, BlackBerry GCC (qcc) and so on. Many of them have custom optimizations or other changes which affect output.
  4. even the mainline GCC sometimes has quite drastic changes from one version to another.
  5. the interfaces and executable formats may be different for different platforms, which will also affect the result. Android/Linux uses ELF while iOS has Mach-O. These two have different ideas about how things like shared libraries work.

So, in short: no, the output is almost never the same.


There are several different calling conventions around on ARM platforms. They vary both according to the processor features (for example, on processors with floating point registers (VFP), it's more efficient to pass floats around in them, but you lose compatibility with processors without VFP) and according to the operating system.

A given installation of an operating system defines one calling convention that all programs must use: the calling convention used by the standard library. Occasionally there may be more than one calling convention on a given system; this requires copies of all libraries for each calling convention.

The Android NDK comes with a toolchain including a C compiler (a version of GCC). This version of GCC is set up for Android's calling convention. There is a separate toolchain for the kernels (the kernel doesn't need to use the same conventions since there are no direct function calls between userland programs and the kernel).

iOS has several calling conventions for different processor versions. They are described in the iOS ABI function call guide.

Your Answer

