ld-linux-验证退出代码 [英] ld-linux --verify exit codes

查看:70
本文介绍了ld-linux-验证退出代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从/usr/bin/ldd检查源代码,我看到它使用ld-linux查找可执行文件的依赖项,尽管它首先使用--verify参数调用ld-linux.然后该脚本根据ld-linux --verify调用的退出代码执行不同的操作.

Checking the source from /usr/bin/ldd, I see that it uses ld-linux to find the dependencies of an executable, although it first calls ld-linux with the --verify argument. Then the script acts differently according to the exit code of the ld-linux --verify call.

ld-linux的手册页未提供有关退出代码的任何信息,并且Google搜索没有任何价值.在任何地方(除了查看ld-linux的源代码以外)是否有一些文档提供了ld-linux的退出代码--verfify及其各自含义的列表?

The man page for ld-linux does not provide any info on exit codes, and a Google search turns nothing of value. Is there some documentation anywhere (other than by looking at ld-linux's source code) that provides a list of exit codes for ld-linux --verfify and their respective meanings?

推荐答案

我没有找到任何文档,但是...

I didn't find any documentation, but...

  if (__builtin_expect (mode, normal) == verify)
    {
      /* We were called just to verify that this is a dynamic
         executable using us as the program interpreter.  Exit with an
         error if we were not able to load the binary or no interpreter
         is specified (i.e., this is no dynamically linked binary.  */
      if (main_map->l_ld == NULL)
        _exit (1);

      /* We allow here some platform specific code.  */
#ifdef DISTINGUISH_LIB_VERSIONS
      DISTINGUISH_LIB_VERSIONS;
#endif
      _exit (has_interp ? 0 : 2);
    }

所以...

  • 0表示成功,即程序是动态链接的, 动态链接程序可以处理"
  • 1表示ld-linux无法加载二进制文件"(我得到了 当我使用不存在的,非二进制或静态二进制文件运行ld-linux时)
  • 2表示未指定解释器".更具体地说,程序头表中没有p_type等于PT_INTERP的元素(当我使用共享库运行ld-linux时会得到此信息)
  • 0 means success, i.e. "program is dynamically linked and this dynamic linker can handle it"
  • 1 means ld-linux was "not able to load the binary" (I got this when I ran ld-linux with non-existent, non-binary or static binary file)
  • 2 means "no interpreter is specified". More specifically, there is no element with p_type equal PT_INTERP in program header table (I get this when I run ld-linux with shared library)

没有其他代码.

这篇关于ld-linux-验证退出代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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