转自:http://h21007.www2.hp.com/portal/download/files/unprot/STK/HPUX_STK/libscan.html

Overview

 

This document describes standard HP-UX commands you can use to determine library dependencies in your executable.

 

Determining the shared libraries

 

To determine the shared libraries used by your executable, use the HP-UX chatr command:

chatr executable \>> $PLAN_DIR/stk.shared.libs

This returns a list of the shared libraries used by executable. For example:

a.out: shared executable
shared library dynamic path search:SHLIB_PATH     disabled  second embedded path  disabled  firstNot Defined
shared library list:dynamic   /usr/lib/libX11.2dynamic   /usr/lib/libXt.2dynamic   /usr/lib/libm.2dynamic   /usr/lib/libc.2
shared library binding:deferred static branch prediction disabledkernel assisted branch predictionenabledlazy swap allocation disabledtext segment locking disableddata segment locking disableddata page size: 4Kinstruction page size: 4K

The shared library list section of the chatr output lists all of the shared libraries on which the executable a.out depends (in this case, there are four).

To determine dependencies on nested libraries, run chatr recursively on all of the shared libraries identified:

chatr library >> $PLAN_DIR/stk.shared.libs
Note: On HP-UX 11i on IPF, two forms of chatr are provided. The IPF chatr is in its normal location at /usr/bin/chatr. A PA chatr (for analyzing PA executables and libraries) can be accessed by setting the SDKROOT environment variable to/usr/ccs/pa before calling chatr. Unset SDKROOT to resume using the IPF-based chatr.

Determining the archive libraries

The build process reports any archive files that it depends on if the linker is directed to produce this report.

Modify the build line to include the -W1,-v flags, which produces verbose output including a list of all archive libraries used during the build.

In the following example, the build process loads the math, X11, and Xt libraries. These libraries are linked archive (using the -Wl,-a archive flag). Use the HP-UX grep and sort commands to filter the output. For example, to reduce output to a listing of the libraries used by your software:

grep Searching linker_output | sort -u

A library with a .a suffix is an archive library, while a library with a .sl suffix is a shared library.

% CC -Wl,-a archive -Wl,-v -o a.out \testr.o -lm -lX11 -lXt | grep Searching \| sort -u
Searching library /usr/lib/libX11.a:
Searching library /usr/lib/libXt.a:
Searching library /usr/lib/libc.a:
Searching library /usr/lib/libm.a:
Searching library /usr/lib/milli.a:
%

In this example, the application is using five archive libraries.

Determining the library type (32-bit vs. 64-bit)

Libraries can be of different types (shared or archive, 32-bit or 64-bit, stripped or not stripped). You can use the HP-UX file command to determine the type of a library file. For example:

% file /usr/lib/milli.a
/usr/lib/milli.a: archive file \
-PA-RISC2.0 relocatable library
% file /usr/lib/pa20_64/libc.2
libc.2:  ELF-64 shared object file \
- PA-RISC 2.0 (LP64)
%

In the following example, the file command is used to determine the type of binary files. The example program was compiled to produce a relocatable file and then an executable file. This was done for both 32-bit and 64-bit versions.

% CC -c +DA2.0w test.c
% file test.o
test.o: ELF-64 (Interim)relocatable object file -PA-RISC 2.0 (LP64)
% CC +DA2.0w test.c
% file a.out
a.out:  ELF-64 executable object file -PA-RISC 2.0 (LP64)
% CC -c test.c
% file test.o
test2.o: PA-RISC2.0 relocatable object
% CC test.c
/usr/CCs/bin/ld: (Warning) At least onePA 2.0 object file (test.o) was detected.The linked output may not run on aPA 1.x system.
% file a.out
a.out:  PA-RISC2.0 shared executabledynamically linked -not stripped
%

Determining the library type (CC vs. aC++)

Libraries can be created using objects compiled with either the CC or aC++ compiler. Do not mix CC and aC++ objects. You can use the nm command to determine what compiler was used to compile the objects in a given library. CC libraries will always have the noperfopt symbol in them. Use the nm andgrep commands as follows:

% nm /opt/CC/lib/libGA.a | grep "noperfopt"
__noperfopt__Graph_alg_c_00000ffb_sCC_sub_ATTLC_|1073741992|extern|data|$SHORTDATA$
__noperfopt__dfs_c_00003802_nextv_|1073741984|extern|data  |$SHORTDATA$
__noperfopt__bfs_c_00003725_intermediate_bfs_p_ATTLC_|1073741984|extern|data|$SHORTDATA$
__noperfopt__cycle_c_00003747_cycle1_test_|1073742000|extern|data   |$SHORTDATA$
__noperfopt__component_c_00003736_internal_artic_pts_ATTLC_|1073741984|extern|data|$SHORTDATA$
% nm /opt/aCC/lib/libGA.a | grep "noperfopt"
%

The noperfopt symbol indicates that /opt/CC/libGA.a is a CC library. Likewise, the lack of this symbol in the second example indicates that /opt/aCC/libGA.a is an aC++ library.

Qualifying source code on HP-UX(chatr)相关推荐

  1. 【论文笔记】 Reinforcement-Learning-Guided Source Code Summarization using Hierarchical Attention

    1 INTRODUCTION 软件维护blablabla--代码注释blablabla-- 好的代码注释应具有以下特征:(1) 正确性,正确地阐明代码的意图:(2) 流利,使维护者易于阅读和理解:(3 ...

  2. Pyinstaller 打包 torch 后执行失败 OSError: could not get source code

    1. 问题现象 系统环境 Python 3.6.9 torch 1.2.0 torchvision 0.4.0 Pyinstaller 4.5.1 Pyinstaller 打包 torch 后执行失败 ...

  3. Understanding The React Source Code

    Understanding The React Source Code - Initial Rendering (Simple Component) I UI updating, in its ess ...

  4. DevExpress Components16.2.6 Source Code 编译

    DevExpress 是一个比较有名的界面控件套件,提供了一系列优秀的界面控件.这篇文章将展示如何在拥有源代码的情况下,对 DevExpress 的程序集进行重新编译. 特别提示:重编译后,已安装好的 ...

  5. 转: Source Code Lookup in Eclipse(主要讲的是java的)

    Source Code Lookup in Eclipse https://www.intertech.com/Blog/source-code-lookup-in-eclipse/

  6. python3 pycharm 远程调试 启动报错 ValueError: source code string cannot contain null bytes

    现象: 启动远程调试时,报错 Traceback (most recent call last):File "/root/.pycharm_helpers/pydev/pydevd.py&q ...

  7. 退役笔记一#MySQL = lambda sql : sql + #39; Source Code 4 Explain Plan #39;

    Mysql 查询运行过程 大致分为4个阶段吧: 语法分析(sql_parse.cc<词法分析, 语法分析, 语义检查 >) >>sql_resolver.cc # JOIN.p ...

  8. Source Code Collection for Reproducible Research

    Source Code Collection for Reproducible Research [ http://www.csee.wvu.edu/~xinl/source.html] " ...

  9. Google Chrome Source Code 源码下载

    2019独角兽企业重金招聘Python工程师标准>>> Goolgle 于 2008.09.02 发布了浏览器 Google Chrome.Google Chrome 使用的内核源码 ...

最新文章

  1. spring 框架学习(一)
  2. Microsoft Visual Studio 2012 添加实体数据模型
  3. android调试更换模拟器,在模拟器上调试 Android 磨损
  4. 如何写好技术文章(看张鑫旭老师的直播总结
  5. ssl1762-工厂的烦恼【图论,最短路变形(最长路)】
  6. 风格之争:Coroutine vs Callback
  7. CSS实现水平垂直居中的方法总结
  8. 集群服务器分析系统,集群服务器系统可扩展性的研究与实现
  9. html 免费设计,十款最佳免费Web设计软件一览
  10. 对话罗永浩:手机行业唯一的聪明人死了,我胜算很大
  11. java selector wakeup_java – 如何检测Selector.wakeup调用
  12. 39 个奇葩代码注释,看完笑哭了。
  13. 【洛谷】P1328 [NOIP2014 提高组] 生活大爆炸版石头剪刀布(详细代码)
  14. 疑似苹果平板电脑规格表曝光
  15. Tensorflow2.x框架-神经网络实现鸢尾花分类
  16. VMware XP安装安装程序没有找到硬盘驱动器
  17. Hiveserver2源码剖析---如何实现代理用户
  18. matlab的lambda,lambda算法matlab
  19. 用webbroswer控件自动点击确定按钮
  20. 微信小程序全局变量改变监听

热门文章

  1. Android 使用mp4parser进行视频的分割与合并
  2. 2个1000微法的电容串联是多少微法
  3. CentOS7部署安装CloudStack4.11.0成功添加第一个主机
  4. 如何查看端口被哪个进程占用(Windows/Linux)
  5. vue路由懒加载--2种实现方式
  6. 好用的蓝牙耳机有哪些推荐?十大蓝牙耳机品牌!
  7. 毕业设计 2023-2024年最新信息管理专业毕设选题题目推荐汇总
  8. Eclipse 技巧
  9. 韩国Apple Store为什么那么少
  10. 老闪创业那些事儿(75)——学梦网的地面部队(上)