链接后剥离共享库是否安全? [英] Is it safe to strip a shared library after linking?

查看:56
本文介绍了链接后剥离共享库是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有 lib.so,我编译二进制 mySoft 并将其链接到 lib.so.

Let's suppose that I got lib.so, I compile the binary mySoft and I link this to lib.so.

此时,考虑到一切都按预期工作,是否安全使用 lib.so 并使用 strip -s lib.so 剥离它?

At this point, considering that everything is working as expected, It's safe or not to take lib.so and strip it with strip -s lib.so ?

明确地说,在 mySoft 正确生成后,我对将其他二进制文件链接到我的 lib.so 不感兴趣,我只对保留 感兴趣mySoft 工作并获得一些磁盘空间,可能在性能方面略有优势.

To be clear I'm not interested on linking other binaries to my lib.so after mySoft is properly generated, I'm only interested on keep mySoft working and gain some disk space and maybe a small edge in terms of performances.

推荐答案

是的,它很安全.strip 只删除不需要的符号(因为它们已经被链接了).这些符号对于调试很有用,但它们永远不会只用于执行代码.

Yes, it's safe. strip only removes symbols that are not needed (because they have already been linked). Those symbols are useful for debugging, but they are never needed just for executing the code.

这篇关于链接后剥离共享库是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆