ldd pvs dis on solaris 10

#include <QtGui/QApplication>
#include <QtGui/QDialog>
int main(int argc, char *argv[]) {
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);
    QDialog *tt=new QDialog();
    tt->show();
    return app.exec();
}
//oracle solaris studio 12.3 qt appliction

生成  "qt" 程序
bash-3.2# ldd qt
        libQtGui.so.4 =>         /usr/local/Trolltech/Qt-4.8.7/lib/libQtGui.so.4
        libQtCore.so.4 =>        /usr/local/Trolltech/Qt-4.8.7/lib/libQtCore.so. 4
        libpthread.so.1 =>       /lib/libpthread.so.1
        librt.so.1 =>    /lib/librt.so.1
        libCstd.so.1 =>  /usr/lib/libCstd.so.1
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libthread.so.1 =>        /lib/libthread.so.1
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1
        libgthread-2.0.so.0 =>   /usr/lib/libgthread-2.0.so.0
        libglib-2.0.so.0 =>      /usr/lib/libglib-2.0.so.0
        libpng12.so.0 =>         /usr/lib/libpng12.so.0
        libz.so.1 =>     /usr/lib/libz.so.1
        libfreetype.so.6 =>      /usr/sfw/lib/libfreetype.so.6
        libSM.so.6 =>    /usr/lib/libSM.so.6
        libICE.so.6 =>   /usr/lib/libICE.so.6
        libXrender.so.1 =>       /usr/sfw/lib/libXrender.so.1
        libfontconfig.so.1 =>    /usr/lib/libfontconfig.so.1
        libXext.so.0 =>  /usr/lib/libXext.so.0
        libX11.so.4 =>   /usr/lib/libX11.so.4
        libresolv.so.2 =>        /lib/libresolv.so.2
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        libexpat.so.0 =>         /usr/sfw/lib/libexpat.so.0
        libmp.so.2 =>    /lib/libmp.so.2
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1

左边是应用要找的库

右连是找到的库

 

ldd    -r    <app>  即报告应用是否找不到库,也会报告找不到的函数

 

LD_LIBRARY_PATH:   指定搜索函数库的路径 ,包括了32与64位库

LD_LIBRARY_PATH_32:

LD_LIBRARY_PATH_64:

 

ldd -u  <app>    :检查没有用到的库

 

bash-3.2# ldd -u qt
        libQtGui.so.4 =>         /usr/local/Trolltech/Qt-4.8.7/lib/libQtGui.so.4
        libQtCore.so.4 =>        /usr/local/Trolltech/Qt-4.8.7/lib/libQtCore.so.4
        libpthread.so.1 =>       /lib/libpthread.so.1
        librt.so.1 =>    /lib/librt.so.1
        libCstd.so.1 =>  /usr/lib/libCstd.so.1
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libthread.so.1 =>        /lib/libthread.so.1
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1
        libgthread-2.0.so.0 =>   /usr/lib/libgthread-2.0.so.0
        libglib-2.0.so.0 =>      /usr/lib/libglib-2.0.so.0
        libpng12.so.0 =>         /usr/lib/libpng12.so.0
        libz.so.1 =>     /usr/lib/libz.so.1
        libfreetype.so.6 =>      /usr/sfw/lib/libfreetype.so.6
        libSM.so.6 =>    /usr/lib/libSM.so.6
        libICE.so.6 =>   /usr/lib/libICE.so.6
        libXrender.so.1 =>       /usr/sfw/lib/libXrender.so.1
        libfontconfig.so.1 =>    /usr/lib/libfontconfig.so.1
        libXext.so.0 =>  /usr/lib/libXext.so.0
        libX11.so.4 =>   /usr/lib/libX11.so.4
        libresolv.so.2 =>        /lib/libresolv.so.2
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        libexpat.so.0 =>         /usr/sfw/lib/libexpat.so.0
        libmp.so.2 =>    /lib/libmp.so.2
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1
   未使用的对象=/lib/librt.so.1
   未使用的对象=/lib/libthread.so.1
   未使用的对象=/usr/lib/libgthread-2.0.so.0
   未使用的对象=/usr/lib/libpng12.so.0
   未使用的对象=/usr/lib/libz.so.1
   未使用的对象=/usr/sfw/lib/libfreetype.so.6
   未使用的对象=/usr/lib/libSM.so.6
   未使用的对象=/usr/sfw/lib/libXrender.so.1
   未使用的对象=/usr/lib/libfontconfig.so.1
   未使用的对象=/usr/lib/libXext.so.0
   未使用的对象=/lib/libdl.so.1
   未使用的对象=/lib/libaio.so.1
   未使用的对象=/lib/libmd.so.1
   未使用的对象=/usr/sfw/lib/libexpat.so.0
   未使用的对象=/lib/libmp.so.2
   未使用的对象=/lib/libscf.so.1
   未使用的对象=/lib/libdoor.so.1
   未使用的对象=/lib/libuutil.so.1
   未使用的对象=/lib/libgen.so.1

ldd   -i   <app> 报告库初始化的顺序

bash-3.2# ldd -i qt
        libQtGui.so.4 =>         /usr/local/Trolltech/Qt-4.8.7/lib/libQtGui.so.4
        libQtCore.so.4 =>        /usr/local/Trolltech/Qt-4.8.7/lib/libQtCore.so.4
        libpthread.so.1 =>       /lib/libpthread.so.1
        librt.so.1 =>    /lib/librt.so.1
        libCstd.so.1 =>  /usr/lib/libCstd.so.1
        libCrun.so.1 =>  /usr/lib/libCrun.so.1
        libthread.so.1 =>        /lib/libthread.so.1
        libm.so.2 =>     /lib/libm.so.2
        libc.so.1 =>     /lib/libc.so.1
        libgthread-2.0.so.0 =>   /usr/lib/libgthread-2.0.so.0
        libglib-2.0.so.0 =>      /usr/lib/libglib-2.0.so.0
        libpng12.so.0 =>         /usr/lib/libpng12.so.0
        libz.so.1 =>     /usr/lib/libz.so.1
        libfreetype.so.6 =>      /usr/sfw/lib/libfreetype.so.6
        libSM.so.6 =>    /usr/lib/libSM.so.6
        libICE.so.6 =>   /usr/lib/libICE.so.6
        libXrender.so.1 =>       /usr/sfw/lib/libXrender.so.1
        libfontconfig.so.1 =>    /usr/lib/libfontconfig.so.1
        libXext.so.0 =>  /usr/lib/libXext.so.0
        libX11.so.4 =>   /usr/lib/libX11.so.4
        libresolv.so.2 =>        /lib/libresolv.so.2
        libsocket.so.1 =>        /lib/libsocket.so.1
        libnsl.so.1 =>   /lib/libnsl.so.1
        libdl.so.1 =>    /lib/libdl.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        libexpat.so.0 =>         /usr/sfw/lib/libexpat.so.0
        libmp.so.2 =>    /lib/libmp.so.2
        libscf.so.1 =>   /lib/libscf.so.1
        libdoor.so.1 =>  /lib/libdoor.so.1
        libuutil.so.1 =>         /lib/libuutil.so.1
        libgen.so.1 =>   /lib/libgen.so.1

   检测到循环相依,群组 [1]:
        /lib/libnsl.so.1
        /lib/librt.so.1

   检测到循环相依,群组 [2]:
        /usr/lib/libX11.so.4
        /usr/lib/libXext.so.0

   初始对象=/lib/libc.so.1
   初始对象=/lib/libaio.so.1
   初始对象=/lib/libmd.so.1
   初始对象=/lib/libmp.so.2
   初始对象=/lib/libdoor.so.1
   初始对象=/lib/libuutil.so.1
   初始对象=/lib/libgen.so.1
   初始对象=/lib/libscf.so.1
   init object=/lib/libnsl.so.1 - 循环群组 [1],为以下的引用:
   init object=/lib/librt.so.1 - 循环群组 [1],为以下的引用:
   初始对象=/usr/lib/libz.so.1
   初始对象=/usr/local/Trolltech/Qt-4.8.7/lib/libQtCore.so.4
   初始对象=/usr/lib/libpng12.so.0
   初始对象=/usr/sfw/lib/libfreetype.so.6
   初始对象=/lib/libsocket.so.1
   初始对象=/usr/lib/libICE.so.6
   初始对象=/usr/lib/libSM.so.6
   init object=/usr/lib/libX11.so.4 - 循环群组 [2],为以下的引用:
        /usr/lib/libXext.so.0
   init object=/usr/lib/libXext.so.0 - 循环群组 [2],为以下的引用:
        /usr/lib/libX11.so.4
   初始对象=/usr/sfw/lib/libXrender.so.1
   初始对象=/lib/libresolv.so.2
   初始对象=/usr/local/Trolltech/Qt-4.8.7/lib/libQtGui.so.4
   初始对象=/usr/lib/libCrun.so.1
   初始对象=/usr/lib/libCstd.so.1
   初始对象=/usr/sfw/lib/libexpat.so.0

 

 

file  <app>     :报告文件内容的类型

bash-3.2# file ./qt
./qt:           ELF 32-bit LSB executable 80386 Version 1 [FPU], dynamically linked, not stripped

 

nm   <app>  :报告文件中的符号

a.out

#include <stdio.h>
#include <stdlib.h>

#define RPT 10000000
int main()
{   int i=1;
    for( i=0;i<RPT;i++)
       {
    
             while(1);


       }                  

}

 

bash-3.2# nm a.out


a.out:

[Index]   Value      Size      Type  Bind  Other Shndx   Name

[2]     | 134545652|         0|SECT |LOCL |0    |1      |
[34]    |         0|         0|SECT |LOCL |0    |33     |
[3]     | 134545672|         0|SECT |LOCL |0    |2      |
[4]     | 134545684|         0|SECT |LOCL |0    |3      |
[5]     | 134545924|         0|SECT |LOCL |0    |4      |
[6]     | 134546388|         0|SECT |LOCL |0    |5      |
[7]     | 134547328|         0|SECT |LOCL |0    |6      |
[8]     | 134547376|         0|SECT |LOCL |0    |7      |
[9]     | 134547436|         0|SECT |LOCL |0    |8      |
[10]    | 134547476|         0|SECT |LOCL |0    |9      |
[11]    | 134547540|         0|SECT |LOCL |0    |10     |
[12]    | 134547684|         0|SECT |LOCL |0    |11     |
[13]    | 134548272|         0|SECT |LOCL |0    |12     |
[14]    | 134548304|         0|SECT |LOCL |0    |13     |
[15]    | 134548328|         0|SECT |LOCL |0    |14     |
[16]    | 134613868|         0|SECT |LOCL |0    |15     |
[17]    | 134613924|         0|SECT |LOCL |0    |16     |
[18]    | 134614220|         0|SECT |LOCL |0    |17     |
[19]    | 134614224|         0|SECT |LOCL |0    |18     |
[20]    | 134614280|         0|SECT |LOCL |0    |19     |
[21]    | 134614288|         0|SECT |LOCL |0    |20     |
[22]    | 134614296|         0|SECT |LOCL |0    |21     |
[23]    | 134614300|         0|SECT |LOCL |0    |22     |
[24]    | 134614304|         0|SECT |LOCL |0    |23     |
[25]    |         0|         0|SECT |LOCL |0    |24     |
[26]    |         0|         0|SECT |LOCL |0    |25     |
[27]    |         0|         0|SECT |LOCL |0    |26     |
[28]    |         0|         0|SECT |LOCL |0    |27     |
[29]    |         0|         0|SECT |LOCL |0    |28     |
[30]    |         0|         0|SECT |LOCL |0    |29     |
[31]    |         0|         0|SECT |LOCL |0    |30     |
[32]    |         0|         0|SECT |LOCL |0    |31     |
[33]    |         0|         0|SECT |LOCL |0    |32     |
[53]    |         0|         0|FILE |LOCL |0    |ABS    |2.c
[64]    | 134613924|         0|OBJT |GLOB |0    |16     |_DYNAMIC
[35]    | 134614332|         0|OBJT |LOCL |0    |23     |_END_
[73]    | 134613868|         0|OBJT |GLOB |3    |15     |_GLOBAL_OFFSET_TABLE_
[85]    |         0|         0|NOTY |WEAK |0    |UNDEF  |_Jv_RegisterClasses
[62]    | 134547540|         0|OBJT |GLOB |0    |10     |_PROCEDURE_LINKAGE_TABLE_
[36]    | 134545408|         0|OBJT |LOCL |0    |1      |_START_
[88]    |         0|         0|NOTY |WEAK |0    |UNDEF  |__1cG__CrunMdo_exit_code6F_v_
[55]    | 134614284|         0|OBJT |LOCL |0    |19     |__CTOR_END__
[44]    | 134614280|         0|OBJT |LOCL |0    |19     |__CTOR_LIST__
[56]    | 134614292|         0|OBJT |LOCL |0    |20     |__DTOR_END__
[45]    | 134614288|         0|OBJT |LOCL |0    |20     |__DTOR_LIST__
[46]    | 134614220|         0|OBJT |LOCL |0    |17     |__EH_FRAME_BEGIN__
[57]    | 134614220|         0|OBJT |LOCL |0    |17     |__FRAME_END__
[58]    | 134614296|         0|OBJT |LOCL |0    |21     |__JCR_END__
[47]    | 134614296|         0|OBJT |LOCL |0    |21     |__JCR_LIST__
[66]    | 134614228|         4|OBJT |GLOB |0    |18     |___Argv
[63]    |         0|         0|NOTY |WEAK |0    |UNDEF  |__deregister_frame_info_bases
[39]    | 134614236|         4|OBJT |LOCL |0    |18     |__do_exit_code_ptr
[59]    | 134548212|         0|FUNC |LOCL |0    |11     |__do_global_ctors_aux
[50]    | 134547964|         0|FUNC |LOCL |0    |11     |__do_global_dtors_aux
[84]    | 134614276|         0|OBJT |GLOB |0    |18     |__dso_handle
[77]    | 134547572|         0|FUNC |GLOB |0    |UNDEF  |__fpstart
[79]    | 134547836|       123|FUNC |GLOB |0    |11     |__fsr
[69]    |         0|         0|NOTY |WEAK |0    |UNDEF  |__fsr_init_value
[38]    | 134614232|         4|OBJT |LOCL |0    |18     |__get_exit_frame_monitor_ptr
[87]    | 134614272|         4|OBJT |GLOB |0    |18     |__longdouble_used
[86]    |         0|         0|NOTY |WEAK |0    |UNDEF  |__register_frame_info_bases
[65]    | 134614304|         0|OBJT |GLOB |0    |22     |_edata
[81]    | 134614332|         0|OBJT |GLOB |0    |23     |_end
[72]    | 134614224|         4|OBJT |GLOB |0    |18     |_environ
[67]    | 134548332|         0|OBJT |GLOB |0    |14     |_etext
[74]    | 134547604|         0|FUNC |GLOB |0    |UNDEF  |_exit
[83]    | 134548304|        24|FUNC |GLOB |0    |13     |_fini
[80]    | 134547668|         0|FUNC |WEAK |0    |UNDEF  |_get_exit_frame_monitor[68]    | 134548272|        29|FUNC |GLOB |0    |12     |_init
[75]    | 134548328|         4|OBJT |GLOB |0    |14     |_lib_version
[70]    | 134547960|         1|FUNC |GLOB |0    |11     |_mcount
[82]    | 134547684|       150|FUNC |GLOB |0    |11     |_start
[1]     |         0|         0|FILE |LOCL |0    |ABS    |a.out
[76]    | 134547556|         0|FUNC |GLOB |0    |UNDEF  |atexit
[49]    | 134614304|         1|OBJT |LOCL |0    |23     |completed.1
[41]    |         0|         0|FILE |LOCL |0    |ABS    |crti.s
[60]    |         0|         0|FILE |LOCL |0    |ABS    |crtn.s
[54]    |         0|         0|FILE |LOCL |0    |ABS    |crtstuff.c
[43]    |         0|         0|FILE |LOCL |0    |ABS    |crtstuff.c
[61]    | 134614224|         4|OBJT |WEAK |0    |18     |environ
[78]    | 134547588|         0|FUNC |GLOB |0    |UNDEF  |exit
[52]    | 134548056|         0|FUNC |LOCL |0    |11     |frame_dummy
[37]    |         0|         0|FILE |LOCL |0    |ABS    |fsr.s
[71]    | 134548156|        55|FUNC |GLOB |0    |11     |main
[51]    | 134614308|        24|OBJT |LOCL |0    |23     |object.2
[48]    | 134614300|         0|OBJT |LOCL |0    |22     |p.0
[40]    | 134614240|        32|OBJT |LOCL |0    |18     |trap_table
[42]    |         0|         0|FILE |LOCL |0    |ABS    |values-Xa.c

 

 pvs  <app>  :报告程序需要的库

 bash-3.2# pvs /bin/ls
        libsec.so.1 (SUNW_1.2, SUNWprivate_1.1);
        libc.so.1 (SUNW_1.19, SUNWprivate_1.1);

 

pvs    -d    <库>  :显示库中定的版本

bash-3.2# pvs -d /usr/lib/libc.so.1
        libc.so.1;
        SUNW_1.23;
        SUNW_1.22.7;
        SUNW_1.22.6;
        SUNW_1.22.5;
        SUNW_1.22.4;
        SUNW_1.22.3;
        SUNW_1.22.2;
        SUNW_1.22.1;
        SUNW_1.22;
        SUNW_1.21.3;
        SUNW_1.21.2;
        SUNW_1.21.1;
        SUNW_1.21;
        SUNW_1.20.4;
        SUNW_1.20.1;
        SUNW_1.20;
        SUNW_1.19;
        SUNW_1.18.1;
        SUNW_1.18;
        SUNW_1.17;
        SUNW_1.16;
        SUNW_1.15;
        SUNW_1.14;
        SUNW_1.13;
        SUNW_1.12;
        SUNW_1.11;
        SUNW_1.10;
        SUNW_1.9;
        SUNW_1.8;
        SUNW_1.7;
        SUNW_1.6;
        SUNW_1.5;
        SUNW_1.4;
        SUNW_1.3;
        SUNW_1.2;
        SUNW_1.1;
        SUNW_0.9;
        SUNW_0.8;
        SUNW_0.7;
        SYSVABI_1.3;
        SUNWprivate_1.1;

 

 

pvs -ds  <库> :导出的函数版本 

 

bash-3.2# pvs -ds /usr/lib/libdl.so.1
        libdl.so.1:
                _DYNAMIC;
                _edata;
                _etext;
                _end;
                _PROCEDURE_LINKAGE_TABLE_;
        SUNW_1.5:
                dl_iterate_phdr;
        SUNW_1.4:
                dladdr1;
        SUNW_1.3:
        SUNW_0.8:
                dladdr;
        SUNW_0.7:
                dlopen;
                dlsym;
                dlerror;
                dlclose;
        SUNW_1.2:
        SUNW_1.1:
                dlmopen;
                dldump;
                dlinfo;
        SUNWprivate_1.1:
                _dlerror;
                _dlmopen;
                _dldump;
                _dlinfo;
                _dladdr;
                _dladdr1;
                _dlclose;
                _dlopen;
                _ld_libc;
                _dlsym;

 

 

dis    <app>

gcc  -g 2.c

#include <stdio.h>
#include <stdlib.h>

#define RPT 10000000
int main()
{   int i=1;
    for( i=0;i<RPT;i++)
       {
    
             while(1);


       }                  

}

 

bash-3.2# dis a.out
disassembly for a.out


section .plt
    _PROCEDURE_LINKAGE_TABLE_: ff 35 70 0b 06 08  pushl  0x8060b70
    0x805085a:              ff 25 74 0b 06 08  jmp    *0x8060b74
    0x8050860:              00 00              addb   %al,(%eax)
    0x8050862:              00 00              addb   %al,(%eax)
atexit()
    atexit:                 ff 25 78 0b 06 08  jmp    *0x8060b78
    0x805086a:              68 00 00 00 00     pushl  $0x0
    0x805086f:              e9 e0 ff ff ff     jmp    -0x1b     <_PROCEDURE_LINKAGE_TABLE_>
__fpstart()
    __fpstart:              ff 25 7c 0b 06 08  jmp    *0x8060b7c
    0x805087a:              68 08 00 00 00     pushl  $0x8
    0x805087f:              e9 d0 ff ff ff     jmp    -0x2b     <_PROCEDURE_LINKAGE_TABLE_>
exit()
    exit:                   ff 25 80 0b 06 08  jmp    *0x8060b80
    0x805088a:              68 10 00 00 00     pushl  $0x10
    0x805088f:              e9 c0 ff ff ff     jmp    -0x3b     <_PROCEDURE_LINKAGE_TABLE_>
_exit()
    _exit:                  ff 25 84 0b 06 08  jmp    *0x8060b84
    0x805089a:              68 18 00 00 00     pushl  $0x18
    0x805089f:              e9 b0 ff ff ff     jmp    -0x4b     <_PROCEDURE_LINKAGE_TABLE_>
    0x80508a4:              ff 25 8c 0b 06 08  jmp    *0x8060b8c
    0x80508aa:              68 20 00 00 00     pushl  $0x20
    0x80508af:              e9 a0 ff ff ff     jmp    -0x5b     <_PROCEDURE_LINKAGE_TABLE_>
    0x80508b4:              ff 25 94 0b 06 08  jmp    *0x8060b94
    0x80508ba:              68 28 00 00 00     pushl  $0x28
    0x80508bf:              e9 90 ff ff ff     jmp    -0x6b     <_PROCEDURE_LINKAGE_TABLE_>
    0x80508c4:              ff 25 9c 0b 06 08  jmp    *0x8060b9c
    0x80508ca:              68 30 00 00 00     pushl  $0x30
    0x80508cf:              e9 80 ff ff ff     jmp    -0x7b     <_PROCEDURE_LINKAGE_TABLE_>
_get_exit_frame_monitor()
    _get_exit_frame_monitor: ff 25 a0 0b 06 08  jmp    *0x8060ba0
    0x80508da:              68 38 00 00 00     pushl  $0x38
    0x80508df:              e9 70 ff ff ff     jmp    -0x8b     <_PROCEDURE_LINKAGE_TABLE_>

section .text
_start()
    _start:                 6a 00              pushl  $0x0
    _start+0x2:             6a 00              pushl  $0x0
    _start+0x4:             8b ec              movl   %esp,%ebp
    _start+0x6:             b8 a4 0b 06 08     movl   $0x8060ba4,%eax
    _start+0xb:             85 c0              testl  %eax,%eax
    _start+0xd:             74 09              je     +0xb      <_start+0x18>
    _start+0xf:             52                 pushl  %edx
    _start+0x10:            e8 6b ff ff ff     call   -0x90     <atexit>
    _start+0x15:            83 c4 04           addl   $0x4,%esp
    _start+0x18:            68 50 0b 05 08     pushl  $0x8050b50
    _start+0x1d:            e8 5e ff ff ff     call   -0x9d     <atexit>
    _start+0x22:            83 c4 04           addl   $0x4,%esp
    _start+0x25:            8d 05 d8 0c 06 08  leal   0x8060cd8,%eax
    _start+0x2b:            8b 00              movl   (%eax),%eax
    _start+0x2d:            85 c0              testl  %eax,%eax
    _start+0x2f:            74 15              je     +0x17     <_start+0x46>
    _start+0x31:            8d 05 dc 0c 06 08  leal   0x8060cdc,%eax
    _start+0x37:            8b 00              movl   (%eax),%eax
    _start+0x39:            85 c0              testl  %eax,%eax
    _start+0x3b:            74 09              je     +0xb      <_start+0x46>
    _start+0x3d:            50                 pushl  %eax
    _start+0x3e:            e8 3d ff ff ff     call   -0xbe     <atexit>
    _start+0x43:            83 c4 04           addl   $0x4,%esp
    _start+0x46:            8b 45 08           movl   0x8(%ebp),%eax
    _start+0x49:            8b 15 d0 0c 06 08  movl   0x8060cd0,%edx
    _start+0x4f:            85 d2              testl  %edx,%edx
    _start+0x51:            75 0a              jne    +0xc      <_start+0x5d>
    _start+0x53:            8d 54 85 10        leal   0x10(%ebp,%eax,4),%edx
    _start+0x57:            89 15 d0 0c 06 08  movl   %edx,0x8060cd0
    _start+0x5d:            83 e4 f0           andl   $0xfffffff0,%esp
    _start+0x60:            52                 pushl  %edx
    _start+0x61:            8d 55 0c           leal   0xc(%ebp),%edx
    _start+0x64:            89 15 d4 0c 06 08  movl   %edx,0x8060cd4
    _start+0x6a:            52                 pushl  %edx
    _start+0x6b:            50                 pushl  %eax
    _start+0x6c:            e8 1f ff ff ff     call   -0xdc     <__fpstart>
    _start+0x71:            e8 22 00 00 00     call   +0x27     <__fsr>
    _start+0x76:            e8 d1 01 00 00     call   +0x1d6    <_init>
    _start+0x7b:            e8 58 01 00 00     call   +0x15d    <main>
    _start+0x80:            83 c4 0c           addl   $0xc,%esp
    _start+0x83:            50                 pushl  %eax
    _start+0x84:            50                 pushl  %eax
    _start+0x85:            e8 16 ff ff ff     call   -0xe5     <exit>
    _start+0x8a:            83 c4 04           addl   $0x4,%esp
    _start+0x8d:            e8 1e ff ff ff     call   -0xdd     <_exit>
    _start+0x92:            83 c4 04           addl   $0x4,%esp
    _start+0x95:            f4                 hlt
    0x805097a:              90                 nop
    0x805097b:              90                 nop
__fsr()
    __fsr:                  55                 pushl  %ebp
    __fsr+0x1:              8b ec              movl   %esp,%ebp
    __fsr+0x3:              52                 pushl  %edx
    __fsr+0x4:              51                 pushl  %ecx
    __fsr+0x5:              83 ec 04           subl   $0x4,%esp
    __fsr+0x8:              b9 00 00 00 00     movl   $0x0,%ecx
    __fsr+0xd:              d1 e9              shrl   $0x1,%ecx
    __fsr+0xf:              83 f9 00           cmpl   $0x0,%ecx
    __fsr+0x12:             74 60              je     +0x62     <__fsr+0x74>
    __fsr+0x14:             9b                 fwait
    __fsr+0x15:             d9 7c 24 00        fnstcw 0x0(%esp)
    __fsr+0x19:             8b d1              movl   %ecx,%edx
    __fsr+0x1b:             83 e2 1f           andl   $0x1f,%edx
    __fsr+0x1e:             8a 82 e0 0c 06 08  movb   0x8060ce0(%edx),%al
    __fsr+0x24:             20 44 24 00        andb   %al,0x0(%esp)
    __fsr+0x28:             f7 c1 00 02 00 00  testl  $0x200,%ecx
    __fsr+0x2e:             74 05              je     +0x7      <__fsr+0x35>
    __fsr+0x30:             80 64 24 00 fd     andb   $0xfd,0x0(%esp)
    __fsr+0x35:             8b d1              movl   %ecx,%edx
    __fsr+0x37:             83 e2 60           andl   $0x60,%edx
    __fsr+0x3a:             74 18              je     +0x1a     <__fsr+0x54>
    __fsr+0x3c:             8b c2              movl   %edx,%eax
    __fsr+0x3e:             83 e0 20           andl   $0x20,%eax
    __fsr+0x41:             d1 e0              shll   $0x1,%eax
    __fsr+0x43:             33 d0              xorl   %eax,%edx
    __fsr+0x45:             c1 e2 05           shll   $0x5,%edx
    __fsr+0x48:             66 81 64 24 00 ff  andw   $0xf3ff,0x0(%esp)
                            f3
    __fsr+0x4f:             66 09 54 24 00     orw    %dx,0x0(%esp)
    __fsr+0x54:             81 e1 80 01 00 00  andl   $0x180,%ecx
    __fsr+0x5a:             74 14              je     +0x16     <__fsr+0x70>
    __fsr+0x5c:             81 f1 80 01 00 00  xorl   $0x180,%ecx
    __fsr+0x62:             d1 e1              shll   $0x1,%ecx
    __fsr+0x64:             66 81 64 24 00 ff  andw   $0xfcff,0x0(%esp)
                            fc
    __fsr+0x6b:             66 09 4c 24 00     orw    %cx,0x0(%esp)
    __fsr+0x70:             d9 6c 24 00        fldcw  0x0(%esp)
    __fsr+0x74:             83 c4 04           addl   $0x4,%esp
    __fsr+0x77:             59                 popl   %ecx
    __fsr+0x78:             5a                 popl   %edx
    __fsr+0x79:             5d                 popl   %ebp
    __fsr+0x7a:             c3                 ret
    0x80509f7:              90                 nop
_mcount()
    _mcount:                c3                 ret
    0x80509f9:              90                 nop
    0x80509fa:              90                 nop
    0x80509fb:              90                 nop
__do_global_dtors_aux()
    __do_global_dtors_aux:  55                 pushl  %ebp
    0x80509fd:              89 e5              movl   %esp,%ebp
    0x80509ff:              53                 pushl  %ebx
    0x8050a00:              e8 00 00 00 00     call   +0x5      <0x8050a05>
    0x8050a05:              5b                 popl   %ebx
    0x8050a06:              81 c3 67 01 01 00  addl   $0x10167,%ebx
    0x8050a0c:              52                 pushl  %edx
    0x8050a0d:              80 bb b4 01 00 00  cmpb   $0x0,0x1b4(%ebx)
                            00
    0x8050a14:              74 0d              je     +0xf      <0x8050a23>
    0x8050a16:              eb 3a              jmp    +0x3c     <0x8050a52>
    0x8050a18:              83 c0 04           addl   $0x4,%eax
    0x8050a1b:              89 83 b0 01 00 00  movl   %eax,0x1b0(%ebx)
    0x8050a21:              ff d2              call   *%edx
    0x8050a23:              8b 83 b0 01 00 00  movl   0x1b0(%ebx),%eax
    0x8050a29:              8b 10              movl   (%eax),%edx
    0x8050a2b:              85 d2              testl  %edx,%edx
    0x8050a2d:              75 e9              jne    -0x15     <0x8050a18>
    0x8050a2f:              8b 83 1c 00 00 00  movl   0x1c(%ebx),%eax
    0x8050a35:              85 c0              testl  %eax,%eax
    0x8050a37:              74 12              je     +0x14     <0x8050a4b>
    0x8050a39:              83 ec 0c           subl   $0xc,%esp
    0x8050a3c:              8d 83 60 01 00 00  leal   0x160(%ebx),%eax
    0x8050a42:              50                 pushl  %eax
    0x8050a43:              e8 5c fe ff ff     call   -0x19f    <0x80508a4>
    0x8050a48:              83 c4 10           addl   $0x10,%esp
    0x8050a4b:              c6 83 b4 01 00 00  movb   $0x1,0x1b4(%ebx)
                            01
    0x8050a52:              8b 5d fc           movl   -0x4(%ebp),%ebx
    0x8050a55:              c9                 leave
    0x8050a56:              c3                 ret
    0x8050a57:              90                 nop
frame_dummy()
    frame_dummy:            55                 pushl  %ebp
    0x8050a59:              89 e5              movl   %esp,%ebp
    0x8050a5b:              53                 pushl  %ebx
    0x8050a5c:              e8 00 00 00 00     call   +0x5      <0x8050a61>
    0x8050a61:              5b                 popl   %ebx
    0x8050a62:              81 c3 0b 01 01 00  addl   $0x1010b,%ebx
    0x8050a68:              50                 pushl  %eax
    0x8050a69:              8b 83 24 00 00 00  movl   0x24(%ebx),%eax
    0x8050a6f:              85 c0              testl  %eax,%eax
    0x8050a71:              74 19              je     +0x1b     <0x8050a8c>
    0x8050a73:              53                 pushl  %ebx
    0x8050a74:              6a 00              pushl  $0x0
    0x8050a76:              8d 83 b8 01 00 00  leal   0x1b8(%ebx),%eax
    0x8050a7c:              50                 pushl  %eax
    0x8050a7d:              8d 83 60 01 00 00  leal   0x160(%ebx),%eax
    0x8050a83:              50                 pushl  %eax
    0x8050a84:              e8 2b fe ff ff     call   -0x1d0    <0x80508b4>
    0x8050a89:              83 c4 10           addl   $0x10,%esp
    0x8050a8c:              8b 83 ac 01 00 00  movl   0x1ac(%ebx),%eax
    0x8050a92:              85 c0              testl  %eax,%eax
    0x8050a94:              74 1e              je     +0x20     <0x8050ab4>
    0x8050a96:              8b 8b 2c 00 00 00  movl   0x2c(%ebx),%ecx
    0x8050a9c:              85 c9              testl  %ecx,%ecx
    0x8050a9e:              74 14              je     +0x16     <0x8050ab4>
    0x8050aa0:              83 ec 0c           subl   $0xc,%esp
    0x8050aa3:              8d 83 ac 01 00 00  leal   0x1ac(%ebx),%eax
    0x8050aa9:              50                 pushl  %eax
    0x8050aaa:              e8 15 fe ff ff     call   -0x1e6    <0x80508c4>
    0x8050aaf:              83 c4 10           addl   $0x10,%esp
    0x8050ab2:              89 f6              movl   %esi,%esi
    0x8050ab4:              8b 5d fc           movl   -0x4(%ebp),%ebx
    0x8050ab7:              c9                 leave
    0x8050ab8:              c3                 ret
    0x8050ab9:              90                 nop
    0x8050aba:              90                 nop
    0x8050abb:              90                 nop
main()
    main:                   55                 pushl  %ebp
    main+0x1:               89 e5              movl   %esp,%ebp
    main+0x3:               83 ec 08           subl   $0x8,%esp
    main+0x6:               83 e4 f0           andl   $0xfffffff0,%esp
    main+0x9:               b8 00 00 00 00     movl   $0x0,%eax
    main+0xe:               83 c0 0f           addl   $0xf,%eax
    main+0x11:              83 c0 0f           addl   $0xf,%eax
    main+0x14:              c1 e8 04           shrl   $0x4,%eax
    main+0x17:              c1 e0 04           shll   $0x4,%eax
    main+0x1a:              29 c4              subl   %eax,%esp
    main+0x1c:              c7 45 fc 01 00 00  movl   $0x1,-0x4(%ebp)
                            00
    main+0x23:              c7 45 fc 00 00 00  movl   $0x0,-0x4(%ebp)
                            00
    main+0x2a:              81 7d fc 7f 96 98  cmpl   $0x98967f,-0x4(%ebp)
                            00
    main+0x31:              7f 02              jg     +0x4      <main+0x35>
    main+0x33:              eb fe              jmp    -0x0      <main+0x33>
    main+0x35:              c9                 leave
    main+0x36:              c3                 ret
    0x8050af3:              90                 nop
__do_global_ctors_aux()
    __do_global_ctors_aux:  55                 pushl  %ebp
    0x8050af5:              89 e5              movl   %esp,%ebp
    0x8050af7:              56                 pushl  %esi
    0x8050af8:              53                 pushl  %ebx
    0x8050af9:              e8 00 00 00 00     call   +0x5      <0x8050afe>
    0x8050afe:              5b                 popl   %ebx
    0x8050aff:              81 c3 6e 00 01 00  addl   $0x1006e,%ebx
    0x8050b05:              8d 83 a0 01 00 00  leal   0x1a0(%ebx),%eax
    0x8050b0b:              8d 70 fc           leal   -0x4(%eax),%esi
    0x8050b0e:              8b 40 fc           movl   -0x4(%eax),%eax
    0x8050b11:              eb 08              jmp    +0xa      <0x8050b1b>
    0x8050b13:              90                 nop
    0x8050b14:              83 ee 04           subl   $0x4,%esi
    0x8050b17:              ff d0              call   *%eax
    0x8050b19:              8b 06              movl   (%esi),%eax
    0x8050b1b:              83 f8 ff           cmpl   $-0x1,%eax
    0x8050b1e:              75 f4              jne    -0xa      <0x8050b14>
    0x8050b20:              5b                 popl   %ebx
    0x8050b21:              5e                 popl   %esi
    0x8050b22:              c9                 leave
    0x8050b23:              c3                 ret

section .init
_init()
    _init:                  55                 pushl  %ebp
    _init+0x1:              8b ec              movl   %esp,%ebp
    _init+0x3:              53                 pushl  %ebx
    _init+0x4:              e8 00 00 00 00     call   +0x5      <_init+0x9>
    _init+0x9:              5b                 popl   %ebx
    _init+0xa:              81 c3 33 00 01 00  addl   $0x10033,%ebx
    _init+0x10:             e8 13 ff ff ff     call   -0xe8     <frame_dummy>
    _init+0x15:             e8 aa ff ff ff     call   -0x51     <__do_global_ctors_aux>
    _init+0x1a:             5b                 popl   %ebx
    _init+0x1b:             c9                 leave
    _init+0x1c:             c3                 ret

section .fini
_fini()
    _fini:                  55                 pushl  %ebp
    _fini+0x1:              8b ec              movl   %esp,%ebp
    _fini+0x3:              53                 pushl  %ebx
    _fini+0x4:              e8 00 00 00 00     call   +0x5      <_fini+0x9>
    _fini+0x9:              5b                 popl   %ebx
    _fini+0xa:              81 c3 13 00 01 00  addl   $0x10013,%ebx
    _fini+0x10:             e8 97 fe ff ff     call   -0x164    <__do_global_dtors_aux>
    _fini+0x15:             5b                 popl   %ebx
    _fini+0x16:             c9                 leave
    _fini+0x17:             c3                 ret

 

size  <app>    :报告应用,库,或目标文件中各种段的大小

bash-3.2# size ./a.out
2924 + 436 + 28 = 3388     即可执行代码+数据(已初始化的数据)+bss(未初始化的数据)
bash-3.2# size -fn ./a.out
17(.interp) + 12(.eh_frame_hdr) + 240(.hash) + 464(.dynsym) + 938(.dynstr) + 48(.SUNW_version) + 58(.SUNW_versym) + 40(.SUNW_reloc)
+ 64(.rel.plt) + 144(.plt) + 576(.text) + 29(.init) + 24(.fini) + 4(.rodata) + 56(.got) + 296(.dynamic) + 4(.eh_frame) +
56(.data) + 8(.ctors) + 8(.dtors) + 4(.jcr) + 4(.data.rel.local) + 28(.bss) + 1424(.symtab) + 667(.strtab) + 158(.comment)
+ 67(.debug_abbrev) + 191(.debug_info) + 51(.debug_line) + 52(.debug_frame) + 27(.debug_pubnames) + 32(.debug_aranges) +
306
(.shstrtab) = 6097

 

 

 dumpstabs a.out | grep 2.c
 53:                      2.c  00000000  00000000  LOCAL    FILE  SHN_ABS

-------------------------------------------------------------------------------------------
 dwarfdump a.out | grep 2.c
                DW_AT_name                  2.c
                DW_AT_decl_file             1 //2.c
                DW_AT_decl_file             1 //2.c
//2.c:  [  7,-1]        0x8050abc       // new statement
//2.c:  [  7,-1]        0x8050ad8       // new statement
//2.c:  [  8,-1]        0x8050adf       // new statement
//2.c:  [ 11,-1]        0x8050aef       // new statement
//2.c:  [ 16,-1]        0x8050af1       // new statement
//2.c:  [ 16,-1]        0x8050af3       // new statement        // end of text sequence
                DW_AT_name                  2.c

--------------------------------------------------------------------------------------------------------

 dump -av a.out

----------------------------------------------------------------------------------------------------------

bash-3.2# mcs -p a.out

a.out:

@(#)SunOS 5.10 Generic January 2005

GCC: (GNU) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1514

 

bash-3.2# mcs  -a "hello" a.out

 

bash-3.2# mcs -p a.out

a.out:

@(#)SunOS 5.10 Generic January 2005

GCC: (GNU) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1514 hello

---------------------------------------------------------------------------------------------

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值