转自: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. JavaScript两个变量交换值(不使用临时变量)
  2. 论文中键入行内公式导致行间距变大的解决方案
  3. python php linux-怎么在linux上运行python
  4. python多边形图案_如何用matplotlib中的自定义图案填充多边形?
  5. 笔记本vm系统的分辨率不好调整_关于超高分辨率小动物超声成像系统(3100LT)和多模式、超高分辨率小动物光声/超声成像系统(2100)测试费价格调整通知...
  6. 【Ogre-windows】旋转矩阵及位置解析
  7. mybatis连接oracle12乱码,使用mybatis链接oracle数据库出现账号密码错误解决
  8. mysql 函数用还是不用_Mysql中日期和时间函数应用不用求人
  9. 华中科技大学主校区论文被《SCI》收录的研究
  10. eclipse C/C++执行scanf优先于printf
  11. 机器学习、⼈⼯智能、深度学习是什么关系?
  12. appassembler-maven-plugin插件打包本地依赖的jar
  13. excel合并工作簿怎么做?
  14. 杭电OJ 11页2025//查找其中的最大字母,在该字母后面插入字符串“(max)”
  15. 计算机辅助绘图中测距在哪,cad测距(cad测量距离快捷键)
  16. 惜我者,我惜之; 冷我者,我弃之
  17. 名帖80 苏轼 楷书《南轩梦语》
  18. 关于笔记本电脑触摸板失灵的解决办法
  19. Python 常用的占位符
  20. npm ERR! gyp verb等一系列错

热门文章

  1. 无心剑英汉双语诗001.《春游》
  2. SQL语言中的子查询
  3. Android 一键清理动画
  4. 每天坚持做这几件事,淘宝店铺慢慢火
  5. 【10.22 牛客普及(三)】 牛半仙的妹子串 题解
  6. java inverse_简要分析java中inverse和cascade有何区别
  7. 【科研技巧】根据研究方向查看可投稿期刊或根据数据库收录查看可投稿期刊
  8. 如何用机器学习做广告反作弊(二)
  9. Calico网络策略
  10. 【英语流利说】数据分析师笔试+二面经验