中的ldd命令和pvs命令ldd命令用于判断某个可执行的 binary 档案含有什么动态函式库。 参数说明:--version 打印ldd的版本号-v --verbose 打印所有信息,例如包括符号的版本信息-d --data-relocs 执行符号重部署,并报告缺少的目标对象(只对ELF格式适用)-r -

中的ldd命令和pvs命令

ldd命令用于判断某个可执行的 binary 档案含有什么动态函式库。

参数说明:

--version  打印ldd的版本号

-v --verbose  打印所有信息,例如包括符号的版本信息

-d --data-relocs  执行符号重部署,并报告缺少的目标对象(只对ELF格式适用)

-r --function-relocs  对目标对象和函数执行重新部署,并报告缺少的目标对象和函数(只对ELF格式适用)  www.cit.cn

--help 用法信息

如果命令行中给定的库名字包含'/',这个程序的libc5版本将使用它作为库名字;否则它将在标准位置搜索库。运行一个当前目录下的共享库,加前缀"./"。

错误:

ldd不能工作在a.out格式的共享库上。

ldd不能工作在一些非常老的a.out程序上,这些程序在支持ldd的编译器发行前已经创建。如果你在这种类型的程序上使用ldd,程序将尝试argc = 0的运行方式,其结果不可预知。

例如:

ldd /bin/bash

但是ldd本身不是一个程序,而仅是一个shell脚本:

$ which ldd

/usr/bin/ldd

$ file /usr/bin/ldd

/usr/bin/ldd: Bourne-Again shell script text executable

ldd命令其实是依靠设置一些环境变量而实现的(也就是说ldd的作用只是设置一些环境变量的值)

如:LD_TRACE_LOADED_OBJECTS

只要设置其值非空即可。

$ export LD_TRACE_LOADED_OBJECTS=1

$ ls /usr

linux-gate.so.1 =>  (0xb7fac000)

librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7f93000)

libselinux.so.1 => /lib/libselinux.so.1 (0xb7f79000)

libacl.so.1 => /lib/libacl.so.1 (0xb7f70000)

libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e0d000)

libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7df4000)

/lib/ld-linux.so.2 (0xb7fad000)  www.cit.cn

libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7df0000)

libattr.so.1 => /lib/libattr.so.1 (0xb7dea000)

撤销该环境变量,ls即又可以恢复正常使用:

$ unset LD_TRACE_LOADED_OBJECTS

$ ls  /usr/

bin  games  include  lib  lib32  lib64  local  sbin  share  src  X11R6

更多的环境变量:

1、LD_TRACE_LOADED_OBJECTS

2、LD_WARN

3、LD_BIND_NOW

4、LD_LIBRARY_VERSION

5、LD_VERBOSE

6、LD_DEBUG

ldd默认开启的环境变量是:LD_TRACE_LOADED_OBJECTS=1

其他的变量(和值)分别对应一些选项:

-d, --data-relocs -> LD_WARN=yes

-r, --function-relocs ->LD_WARN和LD_BIND_NOW=yes

-u, --unused -> LD_DEBUG="unused"

-v, --verbose -> LD_VERBOSE=yes  www.cit.cn

LD_TRACE_LOADED_OBJECTS为必要环境变量,其他视具体情况。

ldd命令的本质是执行了:/lib/ld-linux.so.*

我们可以从以上的内容中(ls /usr中)发现:/lib/ld-linux.so.2 (0xb7fad000)。

$ ls -l /lib/ld-linux.so.*

lrwxrwxrwx 1 root root 9 2009-09-05 22:54 /lib/ld-linux.so.2 -> ld-2.9.so

刚编译后的文件可能是:/lib/ld.so。如果是libc5则是/lib/ld-linux.so.1, 而glibc2应该是/lib/ld-linux.so.2。

$ /lib/ld-linux.so.2  --list /bin/ls

linux-gate.so.1 =>  (0xb8050000)

librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb8037000)

libselinux.so.1 => /lib/libselinux.so.1 (0xb801d000)

libacl.so.1 => /lib/libacl.so.1 (0xb8014000)

libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7eb1000)

libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7e98000)

/lib/ld-linux.so.2 (0xb8051000)

libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7e94000)

libattr.so.1 => /lib/libattr.so.1 (0xb7e8e000)

我们可以看到以上等同于ldd ls。

ldd可以获得的共享库文件,其实是通过读取ldconfig命令组建起来的文件(/etc/ld.so.cache)。

默认的共享库文件搜索/lib优先于/usr/lib,而且也只有这个2个目录。如果想要加入其他路径,则需要通过ldconfig命令配置相关文件。

一般ld-linux.so会按照以下顺序搜索共享库:

1、DT_RPATH或DT_RUNPATH段

2、环境变量LD_LIBRARY_PATH

3、/etc/ld.so.cache文件中的路径,但如果可执行程序在连接时候添加了-z nodeflib选项,则跳过。

4、默认路径/lib和/usr/lib,但如果添加了-z nodeflib,则跳过。

PVS

Display the internal version information of dynamic objects within an ELF file. Commonly these files are dynamic executables and shared objects, and possibly relocatable objects. This version information can fall into one of the following two categories:  www.cit.cn

Version definitions described the interface made available by an ELF file. Each version definition is associated to a set of global symbols provided by the file.

Version dependencies describe the binding requirements of dynamic objects on the version definition of any shared object dependencies. When a dynamic object is built with a shared object, the link-editor records information within the dynamic object indicating that the shared object is a dependency.

Syntax

pvs [-d] [-l] [-n] [-o] [-r] [-s] [-v]  [-N name] file

-dPrint version definition information.

-lWhen used with the -s option, print any symbols that have been reduced from global to local binding due to versioning. By convention, these symbol entries are located in the .symtab section, and fall between the FILE symbol representing the output file, and the FILE symbol representing the first input file used to generate the output file. These reduced symbol entries are assigned the fabricated version definition _REDUCED_. No

reduced symbols will be printed if the file has been stripped, or if the symbol

entry convention cannot be determined.

-nNormalize version definition information. By default, all version definitions within the object are displayed. However, version definitions may inherit other version definitions, and under normalization only the head of each inheritance list is displayed.

-oCreate one-line version definition output. By default, file, version definitions, and any symbol output is indented to ease human inspection. This option prefixes each output line with the file and version definition name and may be more useful for analysis with automated tools.  www.cit.cn

-rPrint version dependency (requirements) information.

-sPrint the symbols associated with each version definition. Any data symbols are accompanied with the size, in bytes, of the data item.

-vVerbose output. Indicates any weak version definitions, and any version definition inheritance. When used with the -N and -d options, the inheritance of the base version definition is also shown. When used with the -s option, the version symbol definition is also shown.

-N namePrint only the information for the given version definition name and any of its inherited version definitions (when used with the -d option), or for the given dependency file name (when used with the -r option).

fileThe ELF file about which internal version information is displayed.

Examples

pvs /usr/lib/64/libc.so.1

作者 icybay

linux pvs命令安装,Linux中的ldd命令和pvs命令相关推荐

  1. dd命令安装Linux

    面对大批量服务器的安装,人们往往热衷于选择"无人值守安装"的方式,而此方式需要对服务器进行过多的配置,并不适合初学者. 无人值守安装(Kickstart),又称全自动安装,其工作原 ...

  2. 模拟linux终端测试java,介绍一个在线的Linux,没有安装Linux或者虚拟机不喜欢用的童鞋可以简单的用这个jslinux测试各种命令...

    介绍一个在线的Linux,没有安装Linux或者虚拟机不喜欢用的童鞋可以简单的用这个jslinux测试各种命令 这个是不错的选择,注意IE浏览器不能使用,用的话换成Chrome或者FireFox浏览器 ...

  3. dd命令安装Linux安装教程详细步骤

    面对大批量服务器的安装,人们往往热衷于选择"无人值守安装"的方式,而此方式需要对服务器进行过多的配置,并不适合初学者. 无人值守安装(Kickstart),又称全自动安装,其工作原 ...

  4. linux mint 安装内核,使用Ukuu在Ubuntu/Linux Mint上安装Linux Kernel 5.0的方法

    Linux Kernel 5.0已发布,具有大量新功能和错误修复,本文介绍使用Ukuu在Ubuntu 18.04/Linux Mint系统上安装Linux Kernel 5.0的方法.默认情况下,Ub ...

  5. SLAM导航机器人零基础实战系列:(一)Linux基础——2.安装Linux发行版ubuntu系统

    SLAM导航机器人零基础实战系列:(一)Linux基础--2.安装Linux发行版ubuntu系统 摘要 由于机器人SLAM.自动导航.语音交互这一系列算法都在机器人操作系统ROS中有很好的支持,所以 ...

  6. 用Kickstart批量安装Linux系统、Kickstart安装,linux批量安装;Linux的Kickstart的 无人值守安装;linux pxe自动安装linux系统...

    用Kickstart批量安装Linux|Kickstart,批量安装:Linux的Kickstart的 无人值守安装:linux pxe自动安装linux系统: KickStart + DHCP + ...

  7. 创建Linux虚拟机及安装Linux镜像教程(手把手教程)

    创建Linux虚拟机及安装Linux镜像教程(手把手教程) 1.创建Linux虚拟机的准备工作 软件:VMware Workstation Pro(演示以VMware14为例) 镜像:rhel-ser ...

  8. linux系统怎么装搜狗输入法_搜狗输入法linux版怎么安装 linux搜狗输入法安装图文教程...

    搜狗输入法linux版怎么进行安装呢?这里给大家分享的是搜狗输入法linux版怎么安装 linux搜狗输入法安装图文教程,一起来看看吧. 搜狗输入法linux版安装指南 Ubuntu / Ubuntu ...

  9. linux的json命令安装,linux 下强大的 JSON 解析命令 jq

    介绍 jq is like sed for JSON data - you can use it to slice and filter and map and transform structure ...

  10. linux磁盘分配方案,安装Linux系统磁盘分配方案.doc

    安装Linux系统磁盘分配方案.doc 安装 Linux系统磁盘分配方案 2009-03-13 0825 Linux系统分区功能简介 / 根目录 /bin 存放必要的命令 /boot 存放内核以及启动 ...

最新文章

  1. bootstrap 两个轮播图冲突_Bootstrap的轮播图样式
  2. RESTful之异常处理 Exceptions
  3. Android -- 消息处理机制源码分析(Looper,Handler,Message)
  4. 目标函数,代价函数,损失函数
  5. 【mysql union all limit的使用】
  6. Eclipse用法和技巧八:自动添加try/catch块1
  7. Maven 实现依赖框架jar包的版本管理
  8. mysql命令导出表结构和数据_mysql-用命令导出、导入表结构或数据
  9. C# WCF快速开发框架 | 原创作品
  10. 全面升级 | ONES Performance 研发效能管理解决方案
  11. 贴片电阻、贴片电容规格、封装、尺寸
  12. 终于能在Linux下用firefox使用支付宝了!!!
  13. 京东商品评论的文本主题分析
  14. One Last Kiss风格封面生成器;程序内存分析工具;Python入门课程资料;神经文本语音合成教程;前沿论文 | ShowMeAI资讯日报
  15. 1990年的图灵奖获得者-Fernando Jose Corbato
  16. fmodex.dll已加载,但找不到入口点怎么解决?
  17. 如何运用知识付费系统,实现内容变现!
  18. macd指标如何看?怎么用MACD指标确定买入和离场点?
  19. Android_(传感器)指南针
  20. 有多少甘特图工具和资源是你熟悉的?

热门文章

  1. KDL简介---KDL、PyKDL、pykdl_utils之间关系
  2. 用canvas制作表情包
  3. 软件版本A.B.C这些数字分别代表什么意思
  4. MFC SDL FFmpeg视频播放器开发教程(一)
  5. Lenovo Y50-70 1080p Hackintosh Catalina
  6. 视频会议系统管理规章制度
  7. figma对比sketch有什么优势和不足?
  8. 0123能组成四位数c语言,用0123四个数字能组成多少个不同的三位数
  9. python去除字符串中的单词_从字符串中删除特定单词的最有效方法
  10. android的补间动画一共包含,Android的四种补间动画