Basically I am trying to re-use some asm code disassembled from a binary on x86 32bit Linux.
I am facing some trouble when references of GOT/GOT.PLT involved like these.
....
804c460: 53 push %ebx
804c461: e8 ec ff ff ff call 804c452 <__i686.get_pc_thunk.bx>
804c466: 81 c3 8e 2b 00 00 add $0x2b8e,%ebx // %ebx has the beginning address of GOT table
804c46c: 83 ec 18 sub $0x18,%esp
....
If I want to re-use these asm code, I have to lift concrete address into symbols, and it seems that in the above code, I have to find a way to let ebx
store the begin address of GOT
table.
Well... then do I have to modify the linker...? Because the begin address of GOT
table can't be decided until link time..
So my questions are:
Is modifying linker a right way to do this ..? Is there any other way?
How to modify the linker in this issue..? I basically have no experiences before..