0

When I try to run my .so file on Android 6 I got this message:

Loading Native Audio Library...
03-20 15:07:55.182 19446 19446  : Cannot Load Native Library !!!
03-20 15:07:55.182 19446 19446  : java.lang.UnsatisfiedLinkError: dlopen failed: /data/app/com.myapp.android.sdk-1/lib/arm/myso.so: has text relocations

From the message I can understand that I have text relocations in my .so file. compile with -fPIC doesn't help since the text relocations are in assembly files that I use to optimize some calculations. How to know where exactly the text relocations are in the source code?

VitalyD
  • 289
  • 1
  • 15
  • Well, looking at the relocation table itself is trivial with something like readelf or objdump - are you asking how to relate those offsets back to locations in source code? – Notlikethat Mar 20 '16 at 14:45
  • @Notlikethat, Im asking how to read GOT table and how to relate the offsets back to my source code. – VitalyD Mar 20 '16 at 15:10

1 Answers1

2

To find the exact location of the text relocs you can use scanelf -T

Here is the Gentoo guide on how to fix text relocations in your binary: https://wiki.gentoo.org/wiki/Hardened/Textrels_Guide

This was a warning for a long time and Android linker started enforcing this in Marshmallow for apps targeting sdk version >= 22 (for lp32 platforms such as arm/x86/mips). And the support for lp64 (arm64/x86_64/mips64) did not exist from the beginning.

dimitry
  • 51
  • 2