ELF 文件版本

发布于 2024-07-13 23:07:49 字数 254 浏览 5 评论 0原文

我正在研究 elfdump 命令的克隆。

在所有可执行文件上运行 elfdump -ecps *file* 时,我的程序工作正常。 但是,当我在库文件(例如 libc.so)上运行程序时,它会为 .symtab 部分中的所有符号打印出错误的版本号(特别是它们全部为零)。 我已经查看了文档很多次,但我不明白为什么会发生这种情况。

有人可以提供一些提示吗? 或者可能如何检测它是否是一个库,以便我可以硬编码一个 0 ?

I'm working on a clone of the elfdump command.

My program works fine when running elfdump -ecps *file* on all executables. However, when I run my program on a library file, say libc.so, it prints out an incorrect version number for all symbols in the .symtab section (specifically they are all zero). I've looked over the documentation tons of times, but I can't figure out why this is happening.

Can someone please provide some tips? Or possibly how to detect whether its a library or not so I could just hard-code a 0 in?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谢绝鈎搭 2024-07-20 23:07:49

我相信,您可以通过检查 e_type 字段是否为 ET_DYN 来确定您是否正在针对共享库运行。 (man elf(5))

有一篇文章,作者: Ulrich Drepper 介绍了 ELF 中的 glibc 每个符号版本控制技巧。 也许那里有您以前没有遇到过的其他信息。 Linux 上的手册页似乎没有涵盖 ELF 文档中每个符号的版本控制信息。

You can determine if you're running against a shared library by checking to see if the e_type field is ET_DYN, I believe. (man elf(5))

There is an article by Ulrich Drepper that covers the glibc per-symbol versioning tricks in ELF. Perhaps there is additional information there which you've not encountered before. The man pages on linux don't appear to cover the per-symbol versioning information in the ELF docs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文