Can I un-dynamicize a linked executable given a dynamic library?

17 Views Asked by At

Suppose I have a dynamically-linked executable which depends on symbols in libfoo and libbar; and that it works on my system, i.e. it finds appropriate versions of these shared libraries. Now, I want to "replace" the dynamic dependencies on libfoo with compiled code from the libfoo I have on my system, obtaining a new executable which only dynamically depends on libbar.

Is this possible? At least, on a modern(ish) Linux system?

If it helps, you may assume additionally that the executable results from a single C source file; that I have this file; that I compiled with/without debug info or with whatever compilation switch you like.

1

There are 1 best solutions below

0
Employed Russian On

Is this possible?

No. Modifying linked a.out or libfoo.so is impossible for all practical purposes.

You might have some luck with the statifier, but that doesn't always work and creates huge binaries.