I want to rewrite object files so that most of the functions' addresses are altered to a no-op function. How can I do this?
More context: In C++ I want to auto-mock all functions by default. To go from having a() call a() {} and b() call b() {} to having a() really call replacement() {} and to have b() also call (the same) replacement() {}.
Things I've considered so far:
objcopy --redefine-syms=filename- this changes the name of a symbol, not the address of it.- Using the linker's
--wrapargument - this requires compiling a distinct symbol__wrap_NameOfWrappedThingfor each thing I want to wrap, and in general doesn't look like it'd scale nicely.