View Issue Details

IDProjectCategoryView StatusLast Update
0037488FPCCompilerpublic2020-08-05 17:58
ReporterBenito van der Zander Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0037488: android x86 so not loading: W+E load segments are not allowed
DescriptionMy Android app does not start on Android 9 (API 28) x86 emulator anymore:

 java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/de.benibela.videlibri.debug-Jxu-_xTCjdFZIqbofRAk2w==/lib/x86/liblclapp.so": W+E load segments are not allowed
    at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
    at java.lang.System.loadLibrary(System.java:1669)
Steps To ReproduceCompile this most simple app .so (or use the attachment):

library lclapp;

{$mode objfpc}{$H+}

{$DEFINE UseCThreads}

uses
jni;



function JNI_OnLoad(vm: PJavaVM; reserved: pointer): jint; {$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
begin
  result := JNI_VERSION_1_6;
end;

procedure JNI_OnUnload(vm: PJavaVM; reserved: pointer); {$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
begin
end;
exports
  JNI_OnLoad name 'JNI_OnLoad',
  JNI_OnUnload name 'JNI_OnUnload';


begin
end.

and load it in Java with System.loadLibrary("lclapp");
Additional InformationI have not tried 64-bit

Everything works with fpc r40721

There is NO WX segment !!

$ readelf -S /tmp/liblclapp.so
There are 26 section headers, starting at offset 0x3e25c:

Section Headers:
  [Nr] Name Type Addr Off Size ES Flg Lk Inf Al
  [ 0] NULL 00000000 000000 000000 00 0 0 0
  [ 1] .note.gnu.build-i NOTE 000000d4 0000d4 000024 00 A 0 0 4
  [ 2] .hash HASH 000000f8 0000f8 00003c 04 A 3 0 4
  [ 3] .dynsym DYNSYM 00000134 000134 0000a0 10 A 4 1 4
  [ 4] .dynstr STRTAB 000001d4 0001d4 00009e 00 A 0 0 1
  [ 5] .gnu.version VERSYM 00000272 000272 000014 02 A 3 0 2
  [ 6] .gnu.version_r VERNEED 00000288 000288 000020 00 A 4 1 4
  [ 7] .rel.dyn REL 000002a8 0002a8 007730 08 A 3 0 4
  [ 8] .rel.plt REL 000079d8 0079d8 000030 08 A 3 9 4
  [ 9] .plt PROGBITS 00007a08 007a08 000070 04 AX 0 0 4
  [10] .text PROGBITS 00007a80 007a80 0284d0 00 AX 0 0 16
  [11] .rodata PROGBITS 0002ff50 02ff50 000474 00 WA 0 0 16
  [12] .eh_frame PROGBITS 000303c4 0303c4 000004 00 A 0 0 4
  [13] .note.android.ide NOTE 000303c8 0303c8 000098 00 A 0 0 2
  [14] .init_array INIT_ARRAY 00031b10 031b10 000004 00 WA 0 0 1
  [15] .fini_array FINI_ARRAY 00031b14 031b14 000008 00 WA 0 0 4
  [16] .dynamic DYNAMIC 00031b1c 031b1c 0000f0 08 WA 4 0 4
  [17] .got PROGBITS 00031c0c 031c0c 0003f4 04 WA 0 0 4
  [18] .data PROGBITS 00032000 032000 00bcac 00 WA 0 0 16
  [19] .bss NOBITS 0003dcb0 03dcac 004154 00 WA 0 0 16
  [20] .stab PROGBITS 00000000 03dcac 0001ec 0c 21 0 4
  [21] .stabstr STRTAB 00000000 03de98 0001d5 00 0 0 1
  [22] .comment PROGBITS 00000000 03e06d 000107 01 MS 0 0 1
  [23] .shstrtab STRTAB 00000000 03e174 0000e7 00 0 0 1
  [24] .symtab SYMTAB 00000000 03e66c 00e310 10 25 3624 4
  [25] .strtab STRTAB 00000000 04c97c 01c84a 00 0 0 1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  p (processor specific)
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Benito van der Zander

2020-08-05 17:58

reporter  

lclapp.lpr (427 bytes)   
library lclapp;

{$mode objfpc}{$H+}

{$DEFINE UseCThreads}

uses
jni;



function JNI_OnLoad(vm: PJavaVM; reserved: pointer): jint; {$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
begin
  result := JNI_VERSION_1_6;
end;

procedure JNI_OnUnload(vm: PJavaVM; reserved: pointer); {$ifdef mswindows}stdcall;{$else}cdecl;{$endif}
begin
end;
exports
  JNI_OnLoad name 'JNI_OnLoad',
  JNI_OnUnload name 'JNI_OnUnload';


begin
end.

lclapp.lpr (427 bytes)   
liblclapp.40721.so (463,545 bytes)
liblclapp.so (430,534 bytes)

Issue History

Date Modified Username Field Change
2020-08-05 17:58 Benito van der Zander New Issue
2020-08-05 17:58 Benito van der Zander File Added: lclapp.lpr
2020-08-05 17:58 Benito van der Zander File Added: liblclapp.40721.so
2020-08-05 17:58 Benito van der Zander File Added: liblclapp.so