binary blob conversions/other blob questions

Michael Hennebry hennebry@web.cs.ndsu.nodak.edu
Thu Feb 19 18:27:00 GMT 2009


On Thu, 19 Feb 2009, Sergey Lapin wrote:

> I've managed to write a wrapper for all globals within blob and
> using objcopy --localize-symbols,--redefine-symbols, I rename
> symbols, making code within blob call my function instead of
> kernel one, and then I can run kernel function there.
> But now I need to replace a function within a blob, which
> is called not only externally, but also internally.
> Is it possible, at all? If yes, how could I achieve my target?
> Source code to blob is lost long ago. Architecture is MIPS,
> object format is ELF, unrelocated. I use binutils-2.17 there.

If it can be done, I think it can be done with --wrap.
That said, it might not be possible:
External_fred:
    ...
    ; don't return yet
External_greg:
    ...
    RET
Overriding one without overriding the other might be difficult.
Can you ascertain whether there are external
references not preceeded by returns?
It's even worse if someone does arithmetic on code addresses.

-- 
Michael   hennebry@web.cs.ndsu.NoDak.edu
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."



More information about the Binutils mailing list