Before this patch we copy foo into real_foo and wrap_foo into foo. The net result is that __wrap_foo shows up twice in the symbol table.
With this patch we save a copy of real_foo and put it in the symbol table slow that was used by the original wrap_foo. We also omit it from the final output if it was undefined.
The net result is that
- Anything using foo now uses __wrap_foo
- Anything using __real_foo now uses foo.
- Anything using __wrap_foo still does.
- The slot for foo now has __wrap_foo
- The slot for __real_foo now has foo
- The slot for wrap_foo now has real_foo
Which I think is the desired behavior.