I read in another SO thread:
With static libraries, the unit of copying is the object file in the library.
In other words, if two programs call a function from a certain object file, both programs end up with all of the object file in the executable.
Yet, the above answer is from 2012 and I was wondering if newer linkers have come up with smarter solutions, that is, solution that only copy those functions into the executable that are actually needed (e.g. because other functions depend on them).
- Are there any general reasons why this is not a good idea or impossible?
- Is there a way I can find out dependencies between functions inside a static library? Does the linker or the linking process provide this information?
By the term dependency I mean the fact that a certain library function is always copied together with another function into the executable.
My overall goal is the following:
I have an unknown binary but I know it contains code from a certain static library. I don't know the version of the library. I also know that this executable uses a certain function from this static library. I would like to know which other functions are also in the executable (no matter if actually used or not).
Thanks for any answers, remarks or ideas.