mylib.so has text relocations. This is wasting memory and is a security risk. Please fix

Jerome picture Jerome · Nov 22, 2013 · Viewed 65.7k times · Source

My Android application (using native library) print this warning on Android 4.4 :

linker mylib.so has text relocations. This is wasting memory and is a security risk. Please fix.

Have you got an idea of what it is and how to fix it ? Thanks,

Answer

Chris Stratton picture Chris Stratton · Dec 3, 2013

This would appear to be a result of two ndk-gcc bugs mentioned at https://code.google.com/p/android/issues/detail?id=23203

and stated there to have been fixed as of ndk-r8c.

It would appear that the check for libraries with the issue has been added only recently.

Note: please do not edit this post to hide the link URL. It is explicit because the destination is what makes it authoritative.

Further Note Changing NDK versions is only a fix when the warning is due to the code of your application. It will have no effect if the warning is instead on a system component such as libdvm - that can only be fixed by a system update.