1

Currently I just started to using NDK and now I have some question in my mind.

Is there anyway to modify previously created .so file using NDK? can we modify that .so file?I just want to change some specification and want to rebuild.

Any help and suggestion will be appreciated.
Thanks in advance

Edit

000064e0 <Pow2>:
    64e0:   e260201e    rsb r2, r0, #30 ; 0x1e
    64e4:   e1a02802    lsl r2, r2, #16
    64e8:   e3a00001    mov r0, #1  ; 0x1
    64ec:   e1a02842    asr r2, r2, #16
    64f0:   e2423001    sub r3, r2, #1  ; 0x1
    64f4:   e1a00310    lsl r0, r0, r3
    64f8:   e59f3054    ldr r3, [pc, #84]   ; 6554 <Pow2+0x74>
    64fc:   e59fc054    ldr ip, [pc, #84]   ; 6558 <Pow2+0x78>
    6500:   e1a01301    lsl r1, r1, #6
    6504:   e08f3003    add r3, pc, r3
    6508:   e92d0030    push    {r4, r5}
    650c:   e793c00c    ldr ip, [r3, ip]
    6510:   e201481f    and r4, r1, #2031616    ; 0x1f0000
    6514:   e1a04844    asr r4, r4, #16
    6518:   e08c5084    add r5, ip, r4, lsl #1
    651c:   e1a04084    lsl r4, r4, #1
    6520:   e19cc0b4    ldrh    ip, [ip, r4]
    6524:   e1d540b2    ldrh    r4, [r5, #2]
    6528:   e3e05902    mvn r5, #32768  ; 0x8000
    652c:   e00510c1    and r1, r5, r1, asr #1
    6530:   e080080c    add r0, r0, ip, lsl #16
    6534:   e064c00c    rsb ip, r4, ip
    6538:   e161018c    smulbb  r1, ip, r1
    653c:   e0400081    sub r0, r0, r1, lsl #1
    6540:   e1a00250    asr r0, r0, r2
    6544:   e1a00800    lsl r0, r0, #16
    6548:   e1a00840    asr r0, r0, #16
    654c:   e8bd0030    pop {r4, r5}
    6550:   e12fff1e    bx  lr
    6554:   0000abcc    .word   0x0000abcc
    6558:   00000078    .word   0x00000078
Hanuman
  • 958
  • 13
  • 35
Juned
  • 6,290
  • 7
  • 45
  • 93

1 Answers1

1

You cannot change the .so file directly. You can, however, change the source code (in C or C++) and recompile it using the NDK. If you do not have access to the source, however, your chances are rather slim.

You may be able to de-compile/disassemble the .so, but it will prove extremely difficult if not impossible to recompile it back into .so

Aleks G
  • 56,435
  • 29
  • 168
  • 265
  • i have source code but the problem is the sources which i have is somewhat diffrent than the soucres which was used to built that library files. so its very difficult to analyze and recompile it again. – Juned Jul 17 '12 at 07:57
  • i think i should try with disassembler first. – Juned Jul 17 '12 at 07:58
  • Then the best you can do is start with the sources you have and try to get the functionality you need. Unfortunately, you won't be able to decompile the .so – Aleks G Jul 17 '12 at 07:59
  • @juned Give it a try. How good are you with assembly language? – Aleks G Jul 17 '12 at 08:00
  • not so good, i have just studied this language in my college as one subject. – Juned Jul 17 '12 at 08:01
  • @juned well, run disassembler on it and see where you can get with it – Aleks G Jul 17 '12 at 08:02
  • didn't find any specific disassembler ! – Juned Jul 17 '12 at 10:05
  • Android NDK provides dissassembler. Use "arm-linux-androideabi-objdump.exe -D libFile.so" for that. – Mārtiņš Možeiko Jul 17 '12 at 18:16
  • @MārtiņšMožeiko thanks for answer, i am using linux so where do i find this libFile.so ? – Juned Jul 23 '12 at 05:46
  • @juned Substitute your .so file for `libFile.so` - and instead of `.exe` you'll have most likely a somewhat different name of the executable. – Aleks G Jul 23 '12 at 07:52
  • @juned I used libFile.so for a name of file you want to disassemble - just put the actual name of your library. And for Linux, as AleksG already says, just omit the .exe suffix. – Mārtiņš Možeiko Jul 23 '12 at 20:54
  • @MārtiņšMožeiko and Aleks G :thanks for pointing me to right direction. i have successfully disassembled the .so file. but the output is somewhat different as i expected. see my edit for output snippet. – Juned Jul 24 '12 at 05:10
  • Well, the output is about what you would expect from a disassembler: the assembly code. This is why I asked whether how good your assembly language was :) – Aleks G Jul 24 '12 at 08:03
  • @AleksG now i got you, to understand that output i must be good enough in Assembly language. – Juned Jul 24 '12 at 10:18