设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 数据 手机
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

ld-linux – 验证退出代码

发布时间:2020-12-30 18:28 所属栏目:118 来源:网络整理
导读:检查来自/usr/bin/ldd的源代码,我看到它使用ld- linux查找可执行文件的依赖项,尽管它首先使用–verify参数调用ld-linux.然后根据ld-linux –verify调用的退出代码,脚本的行为会有所不同. ld-linux的手册页没有提供退出代码的任何信息,谷歌搜索没有任何价值.

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

ld-linux的手册页没有提供退出代码的任何信息,谷歌搜索没有任何价值.是否有任何文档(除了通过查看ld-linux的源代码)提供了ld-linux –verfify的退出代码列表及其各自的含义?

解决方法

我没有找到任何文件,但……
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时,我得到了这个)

没有其他代码.

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读