32

For PE executable, I can list the imported symbols using

dumpbin /imports FILE.EXE

or using the depends utility which is GUI application.

nm ELF-binary just returns "no symbols".

phuclv
  • 30,396
  • 15
  • 136
  • 260
Lenik
  • 18,830

4 Answers4

28

Try this:

objdump -T 'ELF-file'
umläute
  • 523
  • 4
  • 19
10

The output from objdump is a little excessive for this purpose, and requires a good bit of parsing to find the actual imports.

I prefer readelf for this purpose:

readelf -d dynamic-buffer-test

Dynamic section at offset 0x630a8 contains 23 entries:
 Tag                Type                 Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]

As you can see, the required libraries are marked with "NEEDED".

CyberTech
  • 119
8

I prefer readelf.

readelf -s <file>

2

Along with the other answers posted here I would like to propose another. The contents printed are a function of the file format, where ELF lends itself nicely to solving this problem.

objdump -p /path/to/binary | grep NEEDED

The grep simply extracts the contents of the Dynamic Section, but its the format of the objdump -p output that makes this a simple solution.

sherrellbc
  • 839
  • 5
  • 17
  • 31