Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dumpbin.exe for Linux to view imports

I'm not sure my question makes sense in a linux way. I'm searching for something that would work similar to dumpbin.exe from Visual Studio toolkit.

Basically I have an existing project with a bunch of libraries and a single executable. I'd like to figure out which libraries are really needed and which function in each library.

I'm using shared objects only since this project targets an ARM device.

like image 289
Eric Avatar asked Aug 08 '11 14:08

Eric


1 Answers

maybe you can use ldd and nm. ldd will tell you which shared objects (aka dll in win) are needed. and nm will tell dump the symbols.

example run:

$ ldd a
        linux-vdso.so.1 =>  (0x00007fffd1dff000)
        libc.so.6 => /lib/libc.so.6 (0x00007fcbc97d9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fcbc9b21000)
$ nm a
0000000000600e40 d _DYNAMIC
0000000000600fe8 d _GLOBAL_OFFSET_TABLE_
00000000004005b8 R _IO_stdin_used
                 w _Jv_RegisterClasses
0000000000601020 A __bss_start
0000000000601008 D __data_start
0000000000601010 D __dso_handle
                 w __gmon_start__
0000000000600e14 d __init_array_end
0000000000600e14 d __init_array_start
00000000004004d0 T __libc_csu_fini
00000000004004e0 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000601020 A _edata
0000000000601028 A _end
00000000004005a8 T _fini
00000000004003c0 T _init
0000000000400400 T _start
0000000000601008 W data_start
00000000004004b8 T main

EDIT: forgot about objdump. i.e:

$ objdump -f a

a:     file format elf64-x86-64
architecture: i386:x86-64, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x0000000000400400

using -x will give you all headers (quite verbose to post, but try it out :))

like image 108
marcelog Avatar answered Sep 21 '22 21:09

marcelog