Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT 3</strong> I was able to reproduce the 10KB hello-jni binary with NDK r6b. I found an awful hack <a href="http://embdev.net/topic/201054" rel="nofollow">here</a>. Basically put this line in one of your files:</p> <pre><code>char __aeabi_unwind_cpp_pr0[0]; </code></pre> <p>But your code will be lacking exception handling (which I thought was the point of <code>-fno-exceptions</code>....)</p> <p>Anyways, this brings libhello-jni.so down to 2228 bytes for me. Still larger than r5c, but a lot less than 10KB.</p> <p><strong>EDIT 2</strong> Yes it seems like you have a lot of C++ related overhead in your readelf output. Perhaps they changed something between r5c and r6b? There is no C++ code in r5c's hello-jni.c.</p> <p>I have 160 lines of C code that NDK r5c reduces to a 3.8KB .so. Try the following to see what is responsible for the size:</p> <pre><code>/path/to/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/&lt;platform&gt;/bin/arm-linux-androideabi-readelf -a libmylib.so </code></pre> <p><strong>EDIT</strong> I built the hello-jni example with NDK r5c and the resulting <code>libhello-jni.so</code> file is 1588 bytes.</p> <p>Build command:</p> <pre><code>ndk-build V=1 </code></pre> <p>Build output: <a href="http://pastebin.com/AdRDVbnF" rel="nofollow">http://pastebin.com/AdRDVbnF</a> (apparently SO has limits on line length or something).</p> <p>Output from <code>readelf -a libhello-jni.so</code>:</p> <pre> ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: DYN (Shared object file) Machine: ARM Version: 0x1 Entry point address: 0x2dc Start of program headers: 52 (bytes into file) Start of section headers: 1108 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 5 Size of section headers: 40 (bytes) Number of section headers: 12 Section header string table index: 11 Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .hash HASH 000000d4 0000d4 00004c 04 A 2 0 4 [ 2] .dynsym DYNSYM 00000120 000120 0000e0 10 A 3 2 4 [ 3] .dynstr STRTAB 00000200 000200 0000db 00 A 0 0 1 [ 4] .text PROGBITS 000002dc 0002dc 00002c 00 AX 0 0 4 [ 5] .rodata PROGBITS 00000308 000308 000014 00 A 0 0 4 [ 6] .ARM.exidx ARM_EXIDX 0000031c 00031c 000008 00 AL 4 0 4 [ 7] .dynamic DYNAMIC 00001324 000324 000088 08 WA 3 0 4 [ 8] .got PROGBITS 000013ac 0003ac 00000c 04 WA 0 0 4 [ 9] .comment PROGBITS 00000000 0003b8 000012 00 0 0 1 [10] .ARM.attributes ARM_ATTRIBUTES 00000000 0003ca 000029 00 0 0 1 [11] .shstrtab STRTAB 00000000 0003f3 000061 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) There are no section groups in this file. Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align EXIDX 0x00031c 0x0000031c 0x0000031c 0x00008 0x00008 R 0x4 LOAD 0x000000 0x00000000 0x00000000 0x00324 0x00324 R E 0x1000 LOAD 0x000324 0x00001324 0x00001324 0x00094 0x00094 RW 0x1000 DYNAMIC 0x000324 0x00001324 0x00001324 0x00088 0x00088 RW 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4 Section to Segment mapping: Segment Sections... 00 .ARM.exidx 01 .hash .dynsym .dynstr .text .rodata .ARM.exidx 02 .dynamic .got 03 .dynamic 04 Dynamic section at offset 0x324 contains 12 entries: Tag Type Name/Value 0x00000001 (NEEDED) Shared library: [libc.so] 0x00000001 (NEEDED) Shared library: [libstdc++.so] 0x00000001 (NEEDED) Shared library: [libm.so] 0x00000001 (NEEDED) Shared library: [libdl.so] 0x0000000e (SONAME) Library soname: [libhello-jni.so] 0x00000010 (SYMBOLIC) 0x0 0x00000004 (HASH) 0xd4 0x00000005 (STRTAB) 0x200 0x00000006 (SYMTAB) 0x120 0x0000000a (STRSZ) 219 (bytes) 0x0000000b (SYMENT) 16 (bytes) 0x00000000 (NULL) 0x0 There are no relocations in this file. There are no unwind sections in this file. Symbol table '.dynsym' contains 14 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 000002dc 0 SECTION LOCAL DEFAULT 4 2: 00000324 0 NOTYPE GLOBAL DEFAULT ABS __exidx_end 3: 00000000 0 FUNC GLOBAL DEFAULT UND __aeabi_unwind_cpp_pr0 4: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _bss_end__ 5: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start__ 6: 0000031c 0 NOTYPE GLOBAL DEFAULT ABS __exidx_start 7: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_end__ 8: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start 9: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __end__ 10: 000002dd 44 FUNC GLOBAL DEFAULT 4 Java_com_example_hellojni 11: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _edata 12: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _end 13: 000013b8 0 NOTYPE GLOBAL DEFAULT 8 __data_start Histogram for bucket list length (total of 3 buckets): Length Number % of total Coverage 0 0 ( 0.0%) 1 0 ( 0.0%) 0.0% 2 1 ( 33.3%) 16.7% 3 0 ( 0.0%) 16.7% 4 1 ( 33.3%) 50.0% 5 0 ( 0.0%) 50.0% 6 1 ( 33.3%) 100.0% No version information found in this file. Attribute Section: aeabi File Attributes Tag_CPU_name: "5TE" Tag_CPU_arch: v5TE Tag_THUMB_ISA_use: Thumb-1 Tag_ABI_PCS_wchar_t: 4 Tag_ABI_FP_denormal: Needed Tag_ABI_FP_exceptions: Needed Tag_ABI_FP_number_model: IEEE 754 Tag_ABI_align8_needed: Yes Tag_ABI_align8_preserved: Yes, except leaf SP Tag_ABI_enum_size: int Tag_ABI_optimization_goals: Aggressive Debug </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload