Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing linked/referenced files from Object

Status
Not open for further replies.

SteveJR

Programmer
Aug 13, 2001
72
0
0
GB
Hi,

Is there a compiler or Solaris command that can list all the files that have been linked/referenced in the final object?

I want to see what source files/objects were pulled in at compile time to create the final object. Ideally I need to see the source file/object last modified timestamp aswell if possible.

Thanks,

Steve
 
These are general suggestions based on prior experience of a range of compilers and linkers. It's been a long while since I last used the Solaris toolchain.

Most compilers allow you to generate a map file when the final image is produced (see manual).

At its most basic level, this is a list of all the public symbols in the executable.

There may be additional information in yours (or other flags to get other information).

Or perhaps there is a 'verbose' option to the linker, which tells you which files were read and linked?



--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
GNU's [red]ld[/red] with:
-t
--trace
Print the names of the input files as ld processes them.

Should do it, while linking. It should be compatible with POSIX standards, so these options _SHOULD_ work on Solaris and HPUX as well, but I've never tried it on other systems. This won't deal with last modified, but the timestamp should tell you that.

[red]nm[/red], if your system has it, can produce a lot of information about an already compiled bianry object/program. The -A, -o or --print-file-name switches would show you what file each symbol is in... -g or --extern-only will list only external symbols.

Also, running the program in a debuger may be able to help also.

[plug=shameless]
[/plug]
 
Also ldd will tell you all the shared libraries (DLLs in windows terminology) that the system would have loaded.

On HPUX 10.6 ldd is called something completely different.
 
If you are saving the executables in SCCS and keep the file version as a const char*, you can get all the files and versions by executing one of the SCCS commands on the binary. Can't remember which one though: it is 6 years since I last used SCCS.

If you are using one of the other source code control systems, there may be a similar command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top