Obtaining archive(static library) information from an elf file #565
Replies: 1 comment 4 replies
-
Not always. In general, the linker is allowed to shuffle code around a lot. The biggest options to watch are function level linking and link-time code generation. If both are off though (aka the classical linking scenario), it would be possible to chart the boundaries of object files' contributions in the executable, and trace those to libraries they originate in. It would require having a copy of the library it was linked against. Note that that's just code; the library also contributes data to the statically initialized global data sections. If the library contains the debug symbols and so does the executable, that's also a contribution to the executable size. The size estimation won't be and can't be exact, since the process of linking involves more than just concatenating pieces of files together even in the classical model. What is this for to begin with, by the way? |
Beta Was this translation helpful? Give feedback.
-
Hi all,
I wonder, using pyelftools or in general with elf files, if we can extract the archive information for a symbol?
For instance in a gcc map file we have:
I would like to obtain the library information: library.a from the associated elf file.
End goal is to calculate the size contribution of a particular library that is linked.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions