I come from Windows and I generated a C++ static library (libMyLib.a) with gcc.
In Windows you can actually generate a debug static library (.lib) with debugging information and unoptimized; then you can also generate a release static library (.lib) without debugging information and meant to be linked in the final product statically.
I did
$ objdump --syms libMyLib.a | grep "debug"
and got a bunch of lines like
0000000000002ea0 l F .text 00000000000001fc _ZN12_GLOBAL__N_121debugMyFunction2Ejllj
since there's the 'debug' suffix I believe this static library is a debug one with debugging information embedded into it. I'm not sure why this is extremely smaller compared to the Windows one (300 MB for Windows while only 13 MB for Linux).. I suspect some debugging information is missing.
I have two questions at this point:
A binary file, wether it is a static lib, a dynamic lib, an executable program or anything else, may contain or not debug information. It's your compilation option that determine wether debug information should be generated or not. For example, for gcc, see: https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.