title: Why does arm-linux-androideabi-gcc enforce -fpic?
body: <p>I was surprised to see that gcc enforces code to be position independent, even if such flag wasn't provided explicitly in the command line.</p>
  
  <p>I suspect it might have to do with certain expectations from Android's dynamic loader (e.g. expectations on relocation types and freedom to put code wherever it wants) but I am not certain.</p>
  
  <p>Can anybody explain why that really is?</p>
  
  <pre><code>$ arm-linux-androideabi-gcc --version | grep GCC
  arm-linux-androideabi-gcc (GCC) 4.4.3
  
  $ arm-linux-androideabi-gcc -v -S main.c |&amp; grep fpic
   /home1/local64/android-toolchain/bin/../libexec/gcc/arm-linux-androideabi/4.4.3/cc1 -quiet -v -iprefix /home1/local64/android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.4.3/ -isysroot /home1/local64/android-toolchain/bin/../sysroot main.c -mbionic -fpic -quiet -dumpbase main.c -march=armv5te -mfloat-abi=soft -mfpu=vfp -auxbase main -version -o main.s
  </code></pre>