什么是 LD_PRELOAD 技巧? [英] What is the LD_PRELOAD trick?

查看:33
本文介绍了什么是 LD_PRELOAD 技巧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在 proggit 上看到了对它的引用并且(截至目前)没有解释.

I came across a reference to it recently on proggit and (as of now) it is not explained.

我怀疑可能是这个,但我不确定.

推荐答案

如果您将 LD_PRELOAD 设置为共享对象的路径,则该文件将在之前加载任何其他库(包括 C 运行时,libc.so).因此,要使用您的特殊 malloc() 实现运行 ls,请执行以下操作:

If you set LD_PRELOAD to the path of a shared object, that file will be loaded before any other library (including the C runtime, libc.so). So to run ls with your special malloc() implementation, do this:

$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls

这篇关于什么是 LD_PRELOAD 技巧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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