]> www.infradead.org Git - users/dwmw2/openconnect.git/commit
android: Build libraries --with-pic
authorKevin Cernekee <cernekee@gmail.com>
Mon, 29 Jan 2018 00:56:18 +0000 (16:56 -0800)
committerKevin Cernekee <cernekee@gmail.com>
Mon, 12 Feb 2018 03:39:14 +0000 (19:39 -0800)
commitb31ca89f298644c271e49addeea6bbedc34b079c
tree40ffed8549922eb9c503ad27036538661eb1edea
parenta486d4208b3a08ca37d962425542259aaffb4012
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>
android/Makefile