如何查看.a(存档)文件的"index"信息?
How to see the "index" information of .a (archive) file?
我假设 gcc 链接器默认调用 ranlib 将索引信息注入存档文件 (.a)。
但是
- 如何通过任何 linux 命令查看此 "index"?
- 是否used/useful链接器在链接生成可执行文件时?
如 GNU ranlib man page 中所述:
ranlib generates an index to the contents of an archive and stores it
in the archive. The index lists each symbol defined by a member of an
archive that is a relocatable object file.
You may use nm -s or nm --print-armap to list this index.
An archive with such an index speeds up linking to the library and
allows routines in the library to call each other without regard to
their placement in the archive.
我假设 gcc 链接器默认调用 ranlib 将索引信息注入存档文件 (.a)。
但是
- 如何通过任何 linux 命令查看此 "index"?
- 是否used/useful链接器在链接生成可执行文件时?
如 GNU ranlib man page 中所述:
ranlib generates an index to the contents of an archive and stores it in the archive. The index lists each symbol defined by a member of an archive that is a relocatable object file.
You may use nm -s or nm --print-armap to list this index.
An archive with such an index speeds up linking to the library and allows routines in the library to call each other without regard to their placement in the archive.