5 ms·
> If the program is statically linked, then nothing can happen Static libs are embedded into most object-file formats (e.g. ELF) as isolated compilation units.
by derefr 6y ago
> If the program is statically linked, then nothing can happen
Static libs are embedded into most object-file formats (e.g. ELF) as isolated compilation units. Could you not just replace the static library within the object-file at the linkage level, in about the same way that old "resource editors" could replace individual resources within object-files, or the same way that programs like mkvmerge can replace individual streams within their target media-container format?
Static vs. dynamic linking is just about whether the top-level symbol table of the executable can be statically precomputed for that linkage. It doesn't impede you from re-computing the symbol table. That's what the linker already does, every time it links two compilation units together!
- brianberns 6y agoDoes a tool that can do this exist? A “relinker”? It’s a neat idea, but one obvious downside is the potential need to relink many executables when a shared component changes.
- DoctorNick 6y agothere is, but nearly all of the ones I've seen are for reverse-engineering purposes.
- ClumsyPilot 6y agoOt seems you are getting downvoted, but for those of us who do not normally dive into the guts of executablea its a fair question
- viraptor 6y agoMore and more often they're not just isolated units. Link time optimisation can mess up that assumption and for example inline things across library borders.