The program is added into the android source tree and compiled along with compilation of android from source code by the android build process. Which generates a dynamically linked executable. This will off-course use the bionic c library. The output from the file command is something like this:

In this compilation method, the program is compiled using “arm-linux-gnueabi-gcc” with a -static flag generating a statically linked executable. The static linking was performed because “arm-linux-gnueabi-gcc” would normally use the glibc, which is not available in android. The output from the file command is something like this:

2 thoughts on “Performance difference of same program compiled differently on android, Why (I don’t know)”

My guess would be, when built statically compiler will be conservative and compile the program for most basic architecture i.e v4 (ARM 7TDMI)
And when built dynamically it would pick up system libraries optimized for the system at runtime. which will be in your case v7 (Cortex-A9 with NEON).
One way to test this hypothesis is to build your application statically by specifying -mcpu=cortex-a9

Even with this the statically linked one is slow then, try getting the libs from target and link statically to see dis assembly.