Let's suppose that I got lib.so
, I compile the binary mySoft
and I link this to lib.so
.
At this point, considering that everything is working as expected, It's safe or not to take lib.so
and strip it with strip -s lib.so
?
To be clear I'm not interested on linking other binaries to my lib.so
after mySoft
is properly generated, I'm only interested on keep mySoft
working and gain some disk space and maybe a small edge in terms of performances.
Shared libraries (also called dynamic libraries) are linked into the program in two stages. First, during compile time, the linker verifies that all the symbols (again, functions, variables and the like) required by the program, are either linked into the program, or in one of its shared libraries.
Simply put, A shared library/ Dynamic Library is a library that is loaded dynamically at runtime for each application that requires it. Dynamic Linking doesn't require the code to be copied, it is done by just placing name of the library in the binary file.
Programs that use shared libraries are usually slower than those that use statically-linked libraries. A more subtle effect is a reduction in "locality of reference." You may be interested in only a few of the routines in a library, and these routines may be scattered widely in the virtual address space of the library.
Yes, it's safe. strip
only removes symbols that are not needed (because they have already been linked). Those symbols are useful for debugging, but they are never needed just for executing the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With