Recent

Author Topic: Android 7: shared libs and text relocations  (Read 3134 times)

tk

  • Sr. Member
  • ****
  • Posts: 361
Android 7: shared libs and text relocations
« on: July 17, 2017, 09:29:37 am »
I use my own FPC built shared libraries in a Xamarin application.
However,  this app issues ugly warning when run on an Android 7 device, see attachment.
(the Xamarin app is built with Android 4 target, that's my minimum. If the app is built with Android 7 target then shared libs fail to load and the app crashes).

Android log shows following notice:
Code: [Select]
/data/app/WRMx_Mobile.Android-1/lib/arm/liboi_runtime.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
I´ve googled about this issue a bit and found only that the cause should be text (code section) relocations in the library.
I assumed the problem was with sections .rel.dyn or .rel.plt which appear in the resulting binary file.
So I tried to compile with -fPIC but the resulting library binary was the same as without -fPIC!

For Android I use now cross-tools auto-downloaded and supplied with fpcupdeluxe (GNU binutils 2.24.90) and I cross-compile from Windows.
FPC #36236, Lazarus #54957, both last updated this year in May via fpcupdeluxe.

Thank you for any help.

EDIT: I've found this issue https://bugs.freepascal.org/view.php?id=31764 which should cover this, will update FPC and test again and report.
« Last Edit: July 17, 2017, 02:23:39 pm by tk »

 

TinyPortal © 2005-2018