Is it possible to patch arm lib in a way that changes branch instruction calling one function to another function call?
I have instruction
B function_a
and want change it to:
B function_b
See this answer for details on how branch instructions are encoded on ARM. Here's what you should do:
Options->General->Number of opcode bytes
to 4 (if it was 0 initially)B
instruction.pc+8
at the B
instruction to the destination, and verify that the displacement in the instruction matches what you expect.Edit->Patch program->Change byte
to modify the current instruction. IDA will update the display, so you can tell whether you've succeeded or not. If you haven't, keep messing with it until you get the bytes you want.File->Produce file->Create .DIF file
.