我可以在已编译的二进制文件中更改“rpath"吗? [英] Can I change 'rpath' in an already compiled binary?

查看:5
本文介绍了我可以在已编译的二进制文件中更改“rpath"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个计划用于废料堆的旧可执行文件,但它还没有.它依赖于一些已从我的环境中删除的库,但我有一些存根库可以正常工作.我想将此可执行文件指向这些存根库.是的,我可以设置 LD_LIBRARY_PATH,但是这个可执行文件是从许多脚本和许多用户中调用的,我很想在一个地方修复它.

I have an old executable that's scheduled for the scrap heap, but it's not there yet. It relies on some libs that have been removed from my environment, but I have some stub libs someplace where it works fine. Id like to point this executable to these stub libs. Yes, i could set LD_LIBRARY_PATH, but this executable is called from many scripts, and many users and I'd love to fix it in one spot.

我没有这方面的来源,而且很难得到.我在想 - 我可以编辑这个文件,使用一个 ELF 感知编辑器,并添加一个简单的 PATH 到 rpath 让它命中新的库吗?这可能吗,或者一旦你创建了一个 ELF 二进制文件,你将东西固定到位置并且它们不能移动?

I don't have source for this, and would be hard to get it. I was thinking - can I edit this file, using an ELF aware editor, and add a simple PATH to rpath to have it hit the new libs? Is this possible, or once you create an ELF binary, you fix things to locations and they can't be moved?

推荐答案

有一个名为 chrpath 的工具可以做到这一点 - 它可能在您的发行版包中可用.

There is a tool called chrpath which can do this - it's probably available in your distribution's packages.

这篇关于我可以在已编译的二进制文件中更改“rpath"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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