Re:Intercepting functions from statically linked libraries
by Ecco on Tuesday March 03, 2015 @05:55PM
(#9141361)
Smart. I'm not sure how solid this is though: you would have to build the dynamic lib exactly as the static binary (same arch, subarch, optimizations, etc...). Now that I think about it I'm even surprised it worked at all in his example.
[ Parent
| on HN ]
Re:Intercepting functions from statically linked libraries
by msherry on Tuesday March 03, 2015 @06:14PM
(#9141470)
Maybe. If you're just loading constants onto the stack, it seems like it would be pretty forgiving of optimizations and such, and even work across architectures (assuming the same endian-ness, at least).
I'd definitely look for init code for some calculation (as it appears the author has done here), rather than actual computation code, since, as you point out, optimizations could have a huge impact on the instructions emitted for those.