HP-UX HB v13.00 Ch-11 - Software Development

HP-UX Handbook – Rev 13.00 Page 54 (of 101)
Chapter 11 Software Development
October 29, 2013
$ ldd a.out
=>
/usr/lib/libc.2 => /tmp/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /tmp/libc.2
ldd(1) belongs to the linker tools.
nm(1)
This command displays symbol tables of objects, archives, executables and shared libraries. The
output shows if a symbol is contained in the file or if it is referenced. See the objects and
executables in the build section for nm(1) outputs.
nm(1) is helpful when searching for unsatisfied symbols (reported at link time) or unresolved
symbols (reported at runtime). You could use a script like the following that makes use of nm(1)
to search all libraries in a directory and report occurrences of the symbol:
for i in *.sl *.a; do
nm $i | grep $1 | grep -e CODE -e DATA
if [ $? -eq 0 ]
then
echo "from $i"
fi
done
nm(1) belongs to the linker tools.
There is a special version of this command that can display the unmangled names of C++
functions, nm++(1). This command, which in reality is a wrapper script for nm(1), belongs to the
aC++ compiler.
odump(1)/elfdump(1)
odump(1) can display a lot of information about 32-bit PA-RISC objects, archives, executables
and shared libraries. odump -help prints all available options and gives a short description. The
following table lists a few of them:
Option
Description
-compunit
Prints a paragraph for each object, can be used to find out which compiler
and which flags were used to compile.
-symbols
Prints all symbols and symbol references. This is similar to nm(1), but it
still works even if the file was stripped (see strip(1)).