android: Build libraries --with-pic
Recent Android OS releases have become stricter about TEXTRELs in
native code. When built without -DPIC, a few of the libgmp assembly
files generate problematic code sequences:
$ scanelf -qT arm-linux-androideabi/openconnect/.libs/libopenconnect.so
libopenconnect.so: (memory/data?) [0x23F320] in (optimized out: previous $a.0) [0x23F2B8]
[...]
0023f2b8 <__gmpn_modexact_1c_odd>:
23f2b8:
e92d0030 push {r4, r5}
23f2bc:
e59f405c ldr r4, [pc, #92] ; 23f320 <__gmpn_modexact_1c_odd+0x68>
[...]
23f320:
003171b8 .word 0x003171b8
In this case, adjusting the address at 23f320 would require making .text
writable, which Android does not want to do.
The solution is to specify --with-pic which causes the LEA macro
($GMP/mpn/arm/arm-defs.m4) to embed a PC-relative address into the code,
avoiding the issue.
Tested on ARM + x86.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>