如何查看共享对象的内部属性?
使用 HP-UX 时,我可以使用 chatr 实用程序来报告共享库的各种内部属性。它还允许我修改我构建的共享库的内部属性。
chatr 实用程序可以报告并在某些情况下修改以下内容:
- 运行时绑定行为、
- 构建时创建的嵌入式库路径列表、
- 库是否受运行时路径查找、
- 内部名称
- 等 影响。等等。
这样的实用程序可用于 Solaris 吗?
编辑:太奇怪了!感谢下面 mark4o 的回答,我重新访问了典型系统 .so(Sol 10 上的 libm.so.2)的 elfdump 输出。然而,奇怪的是,我输错了输入命令:
elfdump libm.so.2 | moe
在一次令人惊奇的机缘巧合中,这给了我一个名为 moe 的实用程序的使用消息,该实用程序的手册页描述部分显示:
moe 实用程序显示了包含保留的运行时链接器标记的路径名的最佳扩展。这些标记可用于定义动态对象内的依赖关系、过滤器和运行路径。这些令牌在运行时的扩展提供了一种灵活的机制来选择在本机上性能最佳的对象和搜索路径。
这将帮助我解决为什么 libm.so.2 shlib 在两台不同的机器上不兼容,导致我的不完整的可执行文件无法在一台服务器上启动。
When using HP-UX I can use the chatr utility to report on various internal attributes of a shared library. It will also allow me to modify the internal attributes of shared libraries that I have built.
The chatr utility can report, and in some cases modify, such things as:
- the run-time binding behaviour,
- the embedded library path list created at build time,
- whether the library is subject to run-time path lookup,
- internal names,
- etc., etc.
Is such a utility available for Solaris?
Edit: Freaky! Thanks to mark4o's answer below I revisited the elfdump output for a typical system .so (libm.so.2 on Sol 10). However, and here's the freaky part, I mistyped the command to enter:
elfdump libm.so.2 | moe
In an amazing stroke of serendipity, this gave me back the usage message for a utility called moe whose man page description section says:
The moe utility manifests the optimal expansion of a path-name containing reserved runtime linker tokens. These tokens can be used to define dependencies, filtees and runpaths within dynamic objects. The expansion of these tokens at runtime, provides a flexible mechanism for selecting objects and search paths that perform best on this machine.
This will help me resolve why a libm.so.2 shlib is not compatible on both of two different machines leaving my incomplete executable unable to start on one server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有关显示信息,请参阅 Solaris
elfdump
和pvs
实用程序。要调试绑定问题,lari< /code>
和
moe
也可能有帮助。但是,这些实用程序没有修改库的能力。For displaying the information, see the Solaris
elfdump
andpvs
utilities. For debugging binding issues,lari
andmoe
may also be helpful. However, these utilities do not have the ability to modify the library.从 Solaris 11(以及之前的一些 OpenSolaris 和 Solaris Express 版本,但不是 Solaris 10 或更早版本)开始,现在有一个 elfedit 工具,用于修改运行时路径和类似属性。
Starting with Solaris 11 (and some of the OpenSolaris & Solaris Express releases leading up to it, but not Solaris 10 or older), there is now an elfedit tool for modifying runtime paths and similar attributes.