How to find Dependent libraries in ELF file?


 
Thread Tools Search this Thread
Special Forums Hardware Filesystems, Disks and Memory How to find Dependent libraries in ELF file?
# 1  
Old 03-28-2008
How to find Dependent libraries in ELF file?

Dear group,

I need to load dependent libraries for an application which is in ELF format.please let me know how to parse the ELF file to find dependent libraries.

thnaks in advance,
Ravinder
# 2  
Old 03-31-2008
If I got it correct, "ldd" is what you need, example :
Quote:
ldd /usr/lib/aspell-0.60/context-filter.so
linux-gate.so.1 => (0x00110000)
libaspell.so.15 => /usr/lib/libaspell.so.15 (0x00118000)
libdl.so.2 => /lib/libdl.so.2 (0x001d9000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x001de000)
libm.so.6 => /lib/libm.so.6 (0x002c9000)
libc.so.6 => /lib/libc.so.6 (0x002f2000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0044b000)
/lib/ld-linux.so.2 (0x009ab000)
# 3  
Old 04-04-2008
thanks for your replay,

yes you are right the the ldd tool lists the dependent shared libraries that the executable requires, along with their paths if found.

But i want to write an application which shoud do the same functionality.
Please suggest me how to interprete the ELF file to collect the information.
i need exactly as LDD tool.
# 4  
Old 04-04-2008
I'm not sure for the programming part, but you can always look at the source code for this tool and start writing your own. Another similar binary which does almost the same is "fdebuginfo" :
Quote:
Displays the Debuginfo paths for a process and its shared modules
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris: ldd doesn't find libraries in exported environment variable LD_LIBRARY_PATH

I have given the relevant details below. Why are the libraries in /export/home/builds/pc9x_root/960/build/powrmart/pmbuild/bin/SunOS.64.r are invisible to ldd? %setenv ... (3 Replies)
Discussion started by: old_as_a_fossil
3 Replies

2. Programming

A help to create an ELF file

Hi!!! How do I create a file .ELF? What code should I use, could help me with a simple code or example? I know programming to Windows by important languages but this seems to be more sistematical, and I really don't know how to. (2 Replies)
Discussion started by: linecoder
2 Replies

3. Shell Programming and Scripting

Two files one file is dependent and it does not show an output

xxxxx (2 Replies)
Discussion started by: vinayrao
2 Replies

4. Solaris

Not a Vaild ELF File

Hi Anyone, I have two disks , one is primary and anothe is mirror. I checked my mirror disk , It was fine. After that i booted from my primary disk, did some installations regarding kernel patches. It did not get booted properly. It says ==================== Not a valid... (2 Replies)
Discussion started by: jegaraman
2 Replies

5. Programming

Reading ELF file Symbol table of C++ program

Folks, I have some program(Test.cpp) as follows, #include<iostream> class Abc { private: int _theVar; public : int printVar(); }; int Abc :: printVar() { _theVar=10; } main() { Abc _t; (2 Replies)
Discussion started by: vinod_chitrali
2 Replies

6. Linux

Reading ELF file Symbol table of C++ program

Folks, I have some program(Test.cpp) as follows, #include<iostream> class Abc { private: int _theVar; public : int printVar(); }; int Abc :: printVar() { _theVar=10; } main() { Abc _t; (0 Replies)
Discussion started by: vinod_chitrali
0 Replies

7. Shell Programming and Scripting

Find programs that are missing libraries.

I had to whip this up, and it seems useful enough to post here. Say you have been cleaning up your filesystem, and you removed a bunch of libraries, or you shuffled around some library directories, and aren't sure if ld.so.conf is correctly setup. You want to sweep through your file system looking... (0 Replies)
Discussion started by: otheus
0 Replies

8. UNIX for Advanced & Expert Users

How can i read a non text file in unix - ELF-64 executable object file - IA64

The binary file is ELF-64 executable object file - IA64. How i know that the source is Is there any comamnd in unix i can read these kind of files or use a thirty party software? Thanks for your help (8 Replies)
Discussion started by: alexcol
8 Replies

9. Linux

editing ELF file

Hello, This is not exactly relevant to Linux kernel but I'm gonna ask any way. Is there any way I can modify a 64-bit ELF object file to make it look like 32-bit ELF object file and link it (using `ld`) with 32-bit ELF file? I tried libelf but was unsuccessful. I had this pretty link... (1 Reply)
Discussion started by: tejuwala
1 Replies

10. Shell Programming and Scripting

Script execution dependent upon a file landing in a certain directory

Hi all, I'm looking to write a script that is dependent upon the existence of 2 files each in separate directories. My thought was to do: **psuedo code ** execute script check directory 1 for file1 if file exists then execute script 2 ( checking directory 2 for file 2) else... (3 Replies)
Discussion started by: keladar
3 Replies
Login or Register to Ask a Question