Example 13 Viewing library dependencies with ldd(1)

By default, ldd prints simple dynamic path information, including the dependencies recorded in the executable (or the shared library) followed by the physical location where the dynamic loader finds these libraries.

$ ldd a.out

./libx.sl =>

./libx.sl

libc.2 =>

 

/lib/pa20_64/libc.2

libdl.1 =>

/lib/pa20_64/libdl.1

The -voption causes ldd to print the dependency relationships along with the dynamic path information.

$ ldd -v a.out

find library=./libx.sl; required by a.out

./libx.sl => ./libx.sl

find library=libc.2; required by a.out

libc.2 => /lib/pa20_64/libc.2

find library=libdl.1; required by /lib/pa20_64/libc.2 libdl.1 => /lib/pa20_64/libdl.1

The -roption to causes it to analyze all symbol references and print information about unsatisfied code and data symbols.

$ ldd -r a.out

./libx.sl

=>

./libx.sl

libc.2 =>

/lib/pa20_64/libc.2

libdl.1 =>

/lib/pa20_64/libdl.1

symbol not

found: val1 (./libx.sl)

symbol not

found: count (./libx.sl)

symbol not

found: func1 (./libx.sl)

symbol not

found: func2 (./libx.sl)

The -y, <symbol> option can be used to point out the module from which the specified symbol is being resolved. It can also be used to point out modules that refer to the specified symbol.

$ ldd -y,bar a.out

libx.so

=>

 

./libx.so

libc.so.1

=>

/usr/lib/hpux32/libc.so.1

libdl.so.1 =>

/usr/lib/hpux32/libdl.so.1

bar (data)

: needed by a.out; found in ./libx.so

bar (data)

: needed by ./libx.so; found in ./libx.so

$ ldd -y,foo a.out

 

 

libx.so

=>

 

./libx.so

libc.so.1 =>

/usr/lib/hpux32/libc.so.1

libdl.so.1 =>

/usr/lib/hpux32/libdl.so.1

foo (code)

: needed by a.out; found in ./libx.so

foo (code)

: needed by ./libx.so; found in ./libx.so

Viewing the Size of Object File Elements with size(1)

The size command produces section size information for each section in your specified object files. It displays the size of the text, data and bss (uninitialized data) sections with the total size of

Viewing the Size of Object File Elements with size(1)

75

Page 75
Image 75
HP UX Software Transition Kit (STK) manual Viewing the Size of Object File Elements with size1