Checking for library dependencies in Windows and Linux

Hi Community,

Today’s post is about identifying and learning about the dependencies our applications might have with shared libraries. One of the beautiful things about software is that it’s universal similar to music, therefore patterns and principles are agnostic of any platform, but they’re also applicable to specific platforms.  In order to get started, we need to understand the concept of executable format and its many flavors. Linux like any other *nix system uses ELFWindows in the other hand uses PE. They both describe code that can run on their corresponding target system. At the same time, it’s fair to say that I can run (and I do) Windows programs on Linux via Wine (which is a compatibility layer that implements a virtual machine or sandbox environment  where “Windows” code is safely executed).

When it comes to shared libraries and dependencies, headaches and issues always arise regardless of the platform. Some of these issues went away with the introduction of .NET back in 2002 that helped alleviate the “DLL Hell”, which it might not “occur”, but different architectures (x86, x64, ARM and Itanium to mention a few) also bring their own set of problems, like referencing a library (e.g.: DLL) from a project that targets a different architecture, or how to differentiate a Win32 library from a .NET assembly is another clear example. I wrote an utility “.NET Library Explorer” (in Spanish) back in 2002 which helps developers to identify and understand libraries a bit better.

Now that we have a better understanding of the subject, let’s start describing and talking about the tools that might help us identify and recognize libraries and their dependencies. 

Let’s start with Linux, shall we? One of the things I love about Linux is that besides being open it also provides a variety of toolchains. There are two utilities that allow me to see at the ELF information of any given executable, so for example LDD (Print shared object dependencies). In this case, I’m printing out all the dependencies required this new Qt project I started working on recently. For a lot of people that are new to Linux, they might get confused when they find out that “Shared Libraries” in Linux can either be .a (static) or .so (dynamically linked). In other words, .a is the equivalent of a .LIB in Visual C++ and .so is a DLL that can be dynamically loaded at runtime.

 

angel@Obi-wan:~/Code/Ubuntu/QtProjects/qtMonoHost/build-qtMonoHost-Desktop_Qt_5_6_0_GCC_64bit-Debug$ ldd qtMonoHost

    linux-vdso.so.1 =>  (0x00007ffe136b7000)

    libmonoboehm-2.0.so.1 => /usr/lib/libmonoboehm-2.0.so.1 (0x00007f6bf3b4a000)

    libQt5Widgets.so.5 => /usr/local/Qt/5.6/gcc_64/lib/libQt5Widgets.so.5 (0x00007f6bf32d7000)

    libQt5Core.so.5 => /usr/local/Qt/5.6/gcc_64/lib/libQt5Core.so.5 (0x00007f6bf2bc5000)

    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6bf2843000)

    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6bf262c000)

    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6bf2263000)

    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6bf1f5a000)

    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6bf1d51000)

    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6bf1b4d000)

    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6bf1930000)

    /lib64/ld-linux-x86-64.so.2 (0x000055bcbfaf9000)

    libQt5Gui.so.5 => /usr/local/Qt/5.6/gcc_64/lib/libQt5Gui.so.5 (0x00007f6bf1138000)

    libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f6bf0ee5000)

    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f6bf0ce3000)

    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f6bf09d1000)

    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f6bf07bf000)

    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f6bf0485000)

    libGL.so.1 => /usr/lib/nvidia-361/libGL.so.1 (0x00007f6bf01f5000)

    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6beffdb000)

    libicui18n.so.56 => /usr/local/Qt/5.6/gcc_64/lib/libicui18n.so.56 (0x00007f6befb41000)

    libicuuc.so.56 => /usr/local/Qt/5.6/gcc_64/lib/libicuuc.so.56 (0x00007f6bef788000)

    libicudata.so.56 => /usr/local/Qt/5.6/gcc_64/lib/libicudata.so.56 (0x00007f6bedda5000)

    libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f6bedb9c000)

    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6bed92c000)

    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f6bed70a000)

    libGLX.so.0 => /usr/lib/nvidia-361/libGLX.so.0 (0x00007f6bed4d7000)

    libGLdispatch.so.0 => /usr/lib/nvidia-361/libGLdispatch.so.0 (0x00007f6bed1ef000)

    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f6becfea000)

    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f6becde4000)

 

At the same time, I could have also used objdump (Display information from object files) to find out the needed files, as shown below in the “Dynamic Section” labeled as NEEDED

 

angel@Obi-wan:~/Code/Ubuntu/QtProjects/qtMonoHost/build-qtMonoHost-Desktop_Qt_5_6_0_GCC_64bit-Debug$ objdump -x qtMonoHost

 

qtMonoHost:     file format elf64-x86-64

qtMonoHost

architecture: i386:x86-64, flags 0x00000112:

EXEC_P, HAS_SYMS, D_PAGED

start address 0x00000000004028b0

 

Program Header:

    PHDR off    0x0000000000000040 vaddr 0x0000000000400040 paddr 0x0000000000400040 align 2**3

         filesz 0x00000000000001f8 memsz 0x00000000000001f8 flags r-x

  INTERP off    0x0000000000000238 vaddr 0x0000000000400238 paddr 0x0000000000400238 align 2**0

         filesz 0x000000000000001c memsz 0x000000000000001c flags r--

    LOAD off    0x0000000000000000 vaddr 0x0000000000400000 paddr 0x0000000000400000 align 2**21

         filesz 0x00000000000048ba memsz 0x00000000000048ba flags r-x

    LOAD off    0x0000000000004b48 vaddr 0x0000000000604b48 paddr 0x0000000000604b48 align 2**21

         filesz 0x0000000000000610 memsz 0x0000000000000618 flags rw-

 DYNAMIC off    0x0000000000004db0 vaddr 0x0000000000604db0 paddr 0x0000000000604db0 align 2**3

         filesz 0x0000000000000240 memsz 0x0000000000000240 flags rw-

    NOTE off    0x0000000000000254 vaddr 0x0000000000400254 paddr 0x0000000000400254 align 2**2

         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--

EH_FRAME off    0x0000000000003f58 vaddr 0x0000000000403f58 paddr 0x0000000000403f58 align 2**2

         filesz 0x00000000000001ac memsz 0x00000000000001ac flags r--

   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4

         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-

   RELRO off    0x0000000000004b48 vaddr 0x0000000000604b48 paddr 0x0000000000604b48 align 2**0

         filesz 0x00000000000004b8 memsz 0x00000000000004b8 flags r--

 

Dynamic Section:

  NEEDED               libmonoboehm-2.0.so.1

  NEEDED               libQt5Widgets.so.5

  NEEDED               libQt5Core.so.5

  NEEDED               libstdc++.so.6

  NEEDED               libgcc_s.so.1

  NEEDED               libc.so.6

  RPATH                $ORIGIN:/usr/local/Qt/5.6/gcc_64/lib

  INIT                 0x0000000000402618

  FINI                 0x0000000000403ba4

  INIT_ARRAY           0x0000000000604b48

  INIT_ARRAYSZ         0x0000000000000008

  FINI_ARRAY           0x0000000000604b50

  FINI_ARRAYSZ         0x0000000000000008

  GNU_HASH             0x0000000000400298

  STRTAB               0x0000000000400cf8

  SYMTAB               0x00000000004002d8

  STRSZ                0x0000000000000e5e

  SYMENT               0x0000000000000018

  DEBUG                0x0000000000000000

  PLTGOT               0x0000000000605000

  PLTRELSZ             0x0000000000000378

  PLTREL               0x0000000000000007

  JMPREL               0x00000000004022a0

  RELA                 0x0000000000401d00

  RELASZ               0x00000000000005a0

  RELAENT              0x0000000000000018

  FLAGS_1              0x0000000000000080

  VERNEED              0x0000000000401c30

  VERNEEDNUM           0x0000000000000005

  VERSYM               0x0000000000401b56

 

Version References:

  required from libgcc_s.so.1:

    0x0b792650 0x00 07 GCC_3.0

  required from libstdc++.so.6:

    0x056bafd3 0x00 08 CXXABI_1.3

    0x08922974 0x00 06 GLIBCXX_3.4

  required from libc.so.6:

    0x09691a75 0x00 09 GLIBC_2.2.5

    0x0d696914 0x00 05 GLIBC_2.4

  required from libQt5Core.so.5:

    0x00058a25 0x00 04 Qt_5

    0x058a2816 0x00 03 Qt_5.6

  required from libQt5Widgets.so.5:

    0x00058a25 0x00 02 Qt_5

 

Sections:

Idx Name          Size      VMA               LMA               File off  Algn

  0 .interp       0000001c  0000000000400238  0000000000400238  00000238  2**0

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  1 .note.ABI-tag 00000020  0000000000400254  0000000000400254  00000254  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  2 .note.gnu.build-id 00000024  0000000000400274  0000000000400274  00000274  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  3 .gnu.hash     00000040  0000000000400298  0000000000400298  00000298  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  4 .dynsym       00000a20  00000000004002d8  00000000004002d8  000002d8  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  5 .dynstr       00000e5e  0000000000400cf8  0000000000400cf8  00000cf8  2**0

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  6 .gnu.version  000000d8  0000000000401b56  0000000000401b56  00001b56  2**1

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  7 .gnu.version_r 000000d0  0000000000401c30  0000000000401c30  00001c30  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  8 .rela.dyn     000005a0  0000000000401d00  0000000000401d00  00001d00  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

  9 .rela.plt     00000378  00000000004022a0  00000000004022a0  000022a0  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 10 .init         0000001a  0000000000402618  0000000000402618  00002618  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

 11 .plt          00000260  0000000000402640  0000000000402640  00002640  2**4

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

 12 .plt.got      00000008  00000000004028a0  00000000004028a0  000028a0  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

 13 .text         000012f2  00000000004028b0  00000000004028b0  000028b0  2**4

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

 14 .fini         00000009  0000000000403ba4  0000000000403ba4  00003ba4  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, CODE

 15 .rodata       00000385  0000000000403bc0  0000000000403bc0  00003bc0  2**5

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 16 .qtversion    00000010  0000000000403f48  0000000000403f48  00003f48  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 17 .eh_frame_hdr 000001ac  0000000000403f58  0000000000403f58  00003f58  2**2

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 18 .eh_frame     00000704  0000000000404108  0000000000404108  00004108  2**3

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 19 .gcc_except_table 000000ae  000000000040480c  000000000040480c  0000480c  2**0

                  CONTENTS, ALLOC, LOAD, READONLY, DATA

 20 .init_array   00000008  0000000000604b48  0000000000604b48  00004b48  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 21 .fini_array   00000008  0000000000604b50  0000000000604b50  00004b50  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 22 .jcr          00000008  0000000000604b58  0000000000604b58  00004b58  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 23 .data.rel.ro  00000250  0000000000604b60  0000000000604b60  00004b60  2**5

                  CONTENTS, ALLOC, LOAD, DATA

 24 .dynamic      00000240  0000000000604db0  0000000000604db0  00004db0  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 25 .got          00000010  0000000000604ff0  0000000000604ff0  00004ff0  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 26 .got.plt      00000140  0000000000605000  0000000000605000  00005000  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 27 .data         00000018  0000000000605140  0000000000605140  00005140  2**3

                  CONTENTS, ALLOC, LOAD, DATA

 28 .bss          00000008  0000000000605158  0000000000605158  00005158  2**0

                  ALLOC

 29 .comment      0000002f  0000000000000000  0000000000000000  00005158  2**0

                  CONTENTS, READONLY

 30 .debug_aranges 000002f0  0000000000000000  0000000000000000  00005187  2**0

                  CONTENTS, READONLY, DEBUGGING

 31 .debug_info   0008935d  0000000000000000  0000000000000000  00005477  2**0

                  CONTENTS, READONLY, DEBUGGING

 32 .debug_abbrev 0000249a  0000000000000000  0000000000000000  0008e7d4  2**0

                  CONTENTS, READONLY, DEBUGGING

 33 .debug_line   00001bf6  0000000000000000  0000000000000000  00090c6e  2**0

                  CONTENTS, READONLY, DEBUGGING

 34 .debug_str    0004406c  0000000000000000  0000000000000000  00092864  2**0

                  CONTENTS, READONLY, DEBUGGING

 35 .debug_ranges 00000300  0000000000000000  0000000000000000  000d68d0  2**0

                  CONTENTS, READONLY, DEBUGGING

SYMBOL TABLE:

0000000000400238 l    d  .interp    0000000000000000              .interp

0000000000400254 l    d  .note.ABI-tag    0000000000000000              .note.ABI-tag

0000000000400274 l    d  .note.gnu.build-id    0000000000000000              .note.gnu.build-id

0000000000400298 l    d  .gnu.hash    0000000000000000              .gnu.hash

00000000004002d8 l    d  .dynsym    0000000000000000              .dynsym

0000000000400cf8 l    d  .dynstr    0000000000000000              .dynstr

0000000000401b56 l    d  .gnu.version    0000000000000000              .gnu.version

0000000000401c30 l    d  .gnu.version_r    0000000000000000              .gnu.version_r

0000000000401d00 l    d  .rela.dyn    0000000000000000              .rela.dyn

00000000004022a0 l    d  .rela.plt    0000000000000000              .rela.plt

0000000000402618 l    d  .init    0000000000000000              .init

0000000000402640 l    d  .plt    0000000000000000              .plt

00000000004028a0 l    d  .plt.got    0000000000000000              .plt.got

00000000004028b0 l    d  .text    0000000000000000              .text

0000000000403ba4 l    d  .fini    0000000000000000              .fini

0000000000403bc0 l    d  .rodata    0000000000000000              .rodata

0000000000403f48 l    d  .qtversion    0000000000000000              .qtversion

0000000000403f58 l    d  .eh_frame_hdr    0000000000000000              .eh_frame_hdr

0000000000404108 l    d  .eh_frame    0000000000000000              .eh_frame

000000000040480c l    d  .gcc_except_table    0000000000000000              .gcc_except_table

0000000000604b48 l    d  .init_array    0000000000000000              .init_array

0000000000604b50 l    d  .fini_array    0000000000000000              .fini_array

0000000000604b58 l    d  .jcr    0000000000000000              .jcr

0000000000604b60 l    d  .data.rel.ro    0000000000000000              .data.rel.ro

0000000000604db0 l    d  .dynamic    0000000000000000              .dynamic

0000000000604ff0 l    d  .got    0000000000000000              .got

0000000000605000 l    d  .got.plt    0000000000000000              .got.plt

0000000000605140 l    d  .data    0000000000000000              .data

0000000000605158 l    d  .bss    0000000000000000              .bss

0000000000000000 l    d  .comment    0000000000000000              .comment

0000000000000000 l    d  .debug_aranges    0000000000000000              .debug_aranges

0000000000000000 l    d  .debug_info    0000000000000000              .debug_info

0000000000000000 l    d  .debug_abbrev    0000000000000000              .debug_abbrev

0000000000000000 l    d  .debug_line    0000000000000000              .debug_line

0000000000000000 l    d  .debug_str    0000000000000000              .debug_str

0000000000000000 l    d  .debug_ranges    0000000000000000              .debug_ranges

0000000000000000 l    df *ABS*    0000000000000000              crtstuff.c

0000000000604b58 l     O .jcr    0000000000000000              __JCR_LIST__

00000000004028e0 l     F .text    0000000000000000              deregister_tm_clones

0000000000402920 l     F .text    0000000000000000              register_tm_clones

0000000000402960 l     F .text    0000000000000000              __do_global_dtors_aux

0000000000605158 l     O .bss    0000000000000001              completed.7585

0000000000604b50 l     O .fini_array    0000000000000000              __do_global_dtors_aux_fini_array_entry

0000000000402980 l     F .text    0000000000000000              frame_dummy

0000000000604b48 l     O .init_array    0000000000000000              __frame_dummy_init_array_entry

0000000000000000 l    df *ABS*    0000000000000000              main.cpp

0000000000403bc4 l     O .rodata    0000000000000001              _ZStL19piecewise_construct

0000000000403bc8 l     O .rodata    0000000000000004              _ZN2QtL13UninitializedE

0000000000403bcc l     O .rodata    0000000000000001              _ZStL13allocator_arg

0000000000403bcd l     O .rodata    0000000000000001              _ZStL6ignore

0000000000403bd0 l     O .rodata    0000000000000004              _ZL8RGB_MASK

0000000000000000 l    df *ABS*    0000000000000000              mainwindow.cpp

0000000000403bd8 l     O .rodata    0000000000000001              _ZStL19piecewise_construct

0000000000403bdc l     O .rodata    0000000000000004              _ZN2QtL13UninitializedE

0000000000403be0 l     O .rodata    0000000000000001              _ZStL13allocator_arg

0000000000403be1 l     O .rodata    0000000000000001              _ZStL6ignore

0000000000403be4 l     O .rodata    0000000000000004              _ZL8RGB_MASK

0000000000000000 l    df *ABS*    0000000000000000              moc_mainwindow.cpp

0000000000403e00 l     O .rodata    0000000000000001              _ZStL19piecewise_construct

0000000000403e04 l     O .rodata    0000000000000004              _ZN2QtL13UninitializedE

0000000000403e08 l     O .rodata    0000000000000001              _ZStL13allocator_arg

0000000000403e09 l     O .rodata    0000000000000001              _ZStL6ignore

0000000000403e0c l     O .rodata    0000000000000004              _ZL8RGB_MASK

0000000000403e20 l     O .rodata    0000000000000070              _ZL29qt_meta_stringdata_MainWindow

0000000000403ea0 l     O .rodata    0000000000000054              _ZL23qt_meta_data_MainWindow

0000000000000000 l    df *ABS*    0000000000000000              crtstuff.c

0000000000404808 l     O .eh_frame    0000000000000000              __FRAME_END__

0000000000604b58 l     O .jcr    0000000000000000              __JCR_END__

0000000000000000 l    df *ABS*    0000000000000000              

0000000000605000 l     O .got.plt    0000000000000000              _GLOBAL_OFFSET_TABLE_

0000000000604db0 l     O .dynamic    0000000000000000              _DYNAMIC

0000000000604b50 l       .init_array    0000000000000000              __init_array_end

0000000000604b48 l       .init_array    0000000000000000              __init_array_start

0000000000403f58 l       .eh_frame_hdr    0000000000000000              __GNU_EH_FRAME_HDR

0000000000605150  w    O .data    0000000000000008              .hidden DW.ref.__gxx_personality_v0

0000000000403790  w    F .text    000000000000001a              _ZN19QBasicAtomicIntegerIiE5derefEv

00000000004029a6 g     F .text    00000000000000be              main

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10leaveEventEP6QEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget4showEv@@Qt_5

0000000000000000       O *UND*    0000000000000000              qt_version_tag@@Qt_5.6

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow16setCentralWidgetEP7QWidget@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget13keyPressEventEP9QKeyEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10closeEventEP11QCloseEvent@@Qt_5

00000000004028b0 g     F .text    000000000000002a              _start

0000000000403ba4 g     F .fini    0000000000000000              _fini

0000000000402a64 g     F .text    00000000000000d4              _ZN10MainWindowC2EP7QWidget

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget6metricEN12QPaintDevice17PaintDeviceMetricE@@Qt_5

000000000040391a  w    F .text    0000000000000036              _ZN10QAtomicOpsIiE4loadIiEET_RKSt6atomicIS2_E

0000000000403674  w    F .text    0000000000000101              _ZN13Ui_MainWindow13retranslateUiEP11QMainWindow

0000000000000000       F *UND*    0000000000000000              _ZN7QObject16disconnectNotifyERK11QMetaMethod@@Qt_5

0000000000402f96  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE1_4_FUNEv

0000000000000000       F *UND*    0000000000000000              _ZNK7QObject10objectNameEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget14setWindowTitleERK7QString@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget17hasHeightForWidthEv@@Qt_5

0000000000403990 g     F .text    000000000000003d              .hidden _ZN10MainWindow18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget13focusOutEventEP11QFocusEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              __stack_chk_fail@@GLIBC_2.4

0000000000402c30  w    F .text    0000000000000043              _ZN9QtPrivate8RefCount5derefEv

0000000000403aea  w    F .text    000000000000003e              _ZNK14QScopedPointerI11QObjectData21QScopedPointerDeleterIS0_EEptEv

0000000000402c94  w    F .text    000000000000001a              _ZN7QStringC2E14QStringDataPtr

0000000000402d70  w    F .text    0000000000000019              _ZN6QFlagsIN2Qt10WindowTypeEEC1EMNS2_7PrivateEi

0000000000605160 g       .bss    0000000000000000              _end

00000000004037aa  w    F .text    0000000000000025              _ZN15QTypedArrayDataItE10deallocateEP10QArrayData

00000000004030e2  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE3_4_FUNEv

0000000000604d98  w    O .data.rel.ro    0000000000000018              _ZTI10MainWindow

0000000000000000       F *UND*    0000000000000000              _ZN10QArrayData10deallocateEPS_mm@@Qt_5

0000000000000000       F *UND*    0000000000000000              mono_jit_init

0000000000000000       F *UND*    0000000000000000              _ZN12QApplicationC1ERiPPci@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZdlPv@@GLIBCXX_3.4

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow16contextMenuEventEP17QContextMenuEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget14dragEnterEventEP15QDragEnterEvent@@Qt_5

0000000000402bd2 g     F .text    0000000000000043              _ZN10MainWindow21on_pushButton_clickedEv

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget11paintEngineEv@@Qt_5

0000000000402ef0  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE0_4_FUNEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget15mousePressEventEP11QMouseEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget13sharedPainterEv@@Qt_5

0000000000403896  w    F .text    0000000000000042              _ZNK17QStaticStringDataILi11EE8data_ptrEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11actionEventEP12QActionEvent@@Qt_5

0000000000403082  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE3_clEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget9hideEventEP10QHideEvent@@Qt_5

0000000000402d20  w    F .text    000000000000004f              _ZN5QRectC1Eiiii

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget9showEventEP10QShowEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _Unwind_Resume@@GCC_3.0

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget11initPainterEP8QPainter@@Qt_5

0000000000000000       O *UND*    0000000000000000              _ZTI11QMainWindow@@Qt_5

0000000000402cc8  w    F .text    0000000000000034              _ZN7QStringD1Ev

00000000004038d8  w    F .text    0000000000000042              _ZNK17QStaticStringDataILi9EE8data_ptrEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget12focusInEventEP11QFocusEvent@@Qt_5

0000000000403d80 u     O .rodata    0000000000000030              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE3_clEvE15qstring_literal

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget15minimumSizeHintEv@@Qt_5

0000000000403b30 g     F .text    0000000000000065              __libc_csu_init

0000000000403776  w    F .text    000000000000001a              _ZNK19QBasicAtomicIntegerIiE4loadEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10paintEventEP11QPaintEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget13dragMoveEventEP14QDragMoveEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget7devTypeEv@@Qt_5

0000000000402bcc g     F .text    0000000000000006              _ZThn16_N10MainWindowD0Ev

0000000000000000       F *UND*    0000000000000000              _ZN11QMetaObject18connectSlotsByNameEP7QObject@@Qt_5

0000000000402cae  w    F .text    0000000000000019              _ZNK7QString7isEmptyEv

0000000000403128  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE4_clEv

00000000004037d0  w    F .text    0000000000000042              _ZNK17QStaticStringDataILi10EE8data_ptrEv

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget16inputMethodQueryEN2Qt16InputMethodQueryE@@Qt_5

0000000000605140  w      .data    0000000000000000              data_start

0000000000000000       F *UND*    0000000000000000              _ZN8QMenuBarC1EP7QWidget@@Qt_5

0000000000605148 g     O .data    0000000000000000              .hidden __dso_handle

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget7devTypeEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK11QObjectData17dynamicMetaObjectEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget14heightForWidthEi@@Qt_5

0000000000402b38 g     F .text    0000000000000067              _ZN10MainWindowD2Ev

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow15createPopupMenuEv@@Qt_5

0000000000000000  w      *UND*    0000000000000000              _ITM_registerTMCloneTable

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget10redirectedEP6QPoint@@Qt_5

0000000000402cfc  w    F .text    0000000000000024              _ZN5QSizeC1Eii

0000000000604b60 g     O .data.rel.ro    0000000000000030              _ZN10MainWindow16staticMetaObjectE

0000000000403bc0 g     O .rodata    0000000000000004              _IO_stdin_used

0000000000000000       F *UND*    0000000000000000              _ZN16QCoreApplication9translateEPKcS1_S1_i@@Qt_5

0000000000403cc0 u     O .rodata    0000000000000038              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE0_clEvE15qstring_literal

0000000000604b90  w    O .data.rel.ro    0000000000000208              _ZTV10MainWindow

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow10addToolBarEN2Qt11ToolBarAreaEP8QToolBar@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget6metricEN12QPaintDevice17PaintDeviceMetricE@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow12setStatusBarEP10QStatusBar@@Qt_5

0000000000605158 g     O .data    0000000000000000              .hidden __TMC_END__

0000000000000000       F *UND*    0000000000000000              _ZN15QAbstractButton7setTextERK7QString@@Qt_5

000000000040303c  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE2_4_FUNEv

0000000000403188  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE4_4_FUNEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11tabletEventEP12QTabletEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _Znwm@@GLIBCXX_3.4

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget13sharedPainterEv@@Qt_5

0000000000000000  w      *UND*    0000000000000000              _ITM_deregisterTMCloneTable

0000000000403ba0 g     F .text    0000000000000002              __libc_csu_fini

0000000000000000       F *UND*    0000000000000000              _ZN7QObject10timerEventEP11QTimerEvent@@Qt_5

0000000000402b38 g     F .text    0000000000000067              _ZN10MainWindowD1Ev

0000000000403d00 u     O .rodata    0000000000000030              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE1_clEvE15qstring_literal

0000000000605140 g       .data    0000000000000000              __data_start

0000000000605158 g       .bss    0000000000000000              __bss_start

0000000000403c80 u     O .rodata    0000000000000030              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE_clEvE15qstring_literal

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow10setMenuBarEP8QMenuBar@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QObject10childEventEP11QChildEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget18focusNextPrevChildEb@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN11QPushButtonC1EP7QWidget@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11resizeEventEP12QResizeEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget14dragLeaveEventEP15QDragLeaveEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindowC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN10QStatusBarC1EP7QWidget@@Qt_5

0000000000000000  w      *UND*    0000000000000000              __gmon_start__

0000000000403970  w    F .text    000000000000001f              _ZNSt13__atomic_baseIiEmmEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidgetC1EPS_6QFlagsIN2Qt10WindowTypeEE@@Qt_5

0000000000402c94  w    F .text    000000000000001a              _ZN7QStringC1E14QStringDataPtr

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget10redirectedEP6QPoint@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZThn16_NK7QWidget11paintEngineEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              mono_config_parse

0000000000402c1c  w    F .text    0000000000000014              _ZStanSt12memory_orderSt23__memory_order_modifier

0000000000402cfc  w    F .text    0000000000000024              _ZN5QSizeC2Eii

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget9moveEventEP10QMoveEvent@@Qt_5

0000000000403a66 g     F .text    0000000000000084              _ZN10MainWindow11qt_metacallEN11QMetaObject4CallEiPPv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10enterEventEP6QEvent@@Qt_5

0000000000605158 g       .data    0000000000000000              _edata

0000000000402d8a  w    F .text    000000000000005f              _ZN7QWidget6resizeEii

0000000000000000       F *UND*    0000000000000000              _ZN7QObject11customEventEP6QEvent@@Qt_5

0000000000402fdc  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE2_clEv

0000000000000000       F *UND*    0000000000000000              __gxx_personality_v0@@CXXABI_1.3

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10wheelEventEP11QWheelEvent@@Qt_5

0000000000402c74  w    F .text    0000000000000020              _ZNK9QtPrivate8RefCount8isStaticEv

0000000000000000  w      *UND*    0000000000000000              _Jv_RegisterClasses

0000000000403f38  w    O .rodata    000000000000000d              _ZTS10MainWindow

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget16inputMethodEventEP17QInputMethodEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget15keyReleaseEventEP9QKeyEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QObject11eventFilterEPS_P6QEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget14mouseMoveEventEP11QMouseEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget9dropEventEP10QDropEvent@@Qt_5

00000000004031ce  w    F .text    00000000000004a6              _ZN13Ui_MainWindow7setupUiEP11QMainWindow

0000000000000000       F *UND*    0000000000000000              _ZN12QApplication4execEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QObject13setObjectNameERK7QString@@Qt_5

0000000000402c15  w    F .text    0000000000000007              _Z7qt_noopv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget17mouseReleaseEventEP11QMouseEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11nativeEventERK10QByteArrayPvPl@@Qt_5

0000000000402dea  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE_clEv

0000000000402618 g     F .init    0000000000000000              _init

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget11initPainterEP8QPainter@@Qt_5

0000000000402ba6 g     F .text    0000000000000026              _ZN10MainWindowD0Ev

0000000000000000       F *UND*    0000000000000000              strcmp@@GLIBC_2.2.5

0000000000402e90  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE0_clEv

0000000000000000       F *UND*    0000000000000000              _Z9qt_assertPKcS0_i@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget6resizeERK5QSize@@Qt_5

0000000000402cc8  w    F .text    0000000000000034              _ZN7QStringD2Ev

0000000000402a64 g     F .text    00000000000000d4              _ZN10MainWindowC1EP7QWidget

0000000000000000       O *UND*    0000000000000000              _ZTVN10__cxxabiv120__si_class_type_infoE@@CXXABI_1.3

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11changeEventEP6QEvent@@Qt_5

0000000000403812  w    F .text    0000000000000042              _ZNK17QStaticStringDataILi13EE8data_ptrEv

0000000000000000       F *UND*    0000000000000000              __libc_start_main@@GLIBC_2.2.5

0000000000402b9f g     F .text    0000000000000006              _ZThn16_N10MainWindowD1Ev

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindowD2Ev@@Qt_5

00000000004039ce g     F .text    0000000000000048              _ZNK10MainWindow10metaObjectEv

0000000000402e4a  w    F .text    0000000000000046              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENUlvE_4_FUNEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget11setGeometryERK5QRect@@Qt_5

0000000000402f36  w    F .text    0000000000000060              _ZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE1_clEv

0000000000402d20  w    F .text    000000000000004f              _ZN5QRectC2Eiiii

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget21mouseDoubleClickEventEP11QMouseEvent@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN7QObject13connectNotifyERK11QMetaMethod@@Qt_5

0000000000403a16 g     F .text    0000000000000050              _ZN10MainWindow11qt_metacastEPKc

0000000000000000       F *UND*    0000000000000000              _ZN12QApplicationD1Ev@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow5eventEP6QEvent@@Qt_5

0000000000403950  w    F .text    000000000000001f              _ZN10QAtomicOpsIiE5derefIiEEbRSt6atomicIT_E

0000000000403d40 u     O .rodata    0000000000000028              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE2_clEvE15qstring_literal

0000000000403dc0 u     O .rodata    0000000000000030              _ZZZN13Ui_MainWindow7setupUiEP11QMainWindowENKUlvE4_clEvE15qstring_literal

0000000000000000       F *UND*    0000000000000000              mono_set_dirs

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow11qt_metacastEPKc@@Qt_5

0000000000000000       O *UND*    0000000000000000              _ZN11QMainWindow16staticMetaObjectE@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZNK7QWidget8sizeHintEv@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN8QToolBarC1EP7QWidget@@Qt_5

0000000000403854  w    F .text    0000000000000042              _ZNK17QStaticStringDataILi7EE8data_ptrEv

0000000000000000       F *UND*    0000000000000000              _ZN7QWidget10setVisibleEb@@Qt_5

0000000000000000       F *UND*    0000000000000000              _ZN11QMainWindow11qt_metacallEN11QMetaObject4CallEiPPv@@Qt_5

 

Now, let’s turn our attention to Windows. Visual Studio installs DumpBin that allows to examine COFF object files, executable (PE as mentioned earlier) and dynamic-link libraries (DLL). One of the many switches it’s got is “/dependents” that produces the  following output (in this case, we’re dumping Explorer.exe). if we wanted, we could have also dumped the exported symbols in a dynamic-library, for instance.

 

Microsoft (R) COFF/PE Dumper Version 14.00.23506.0

Copyright (C) Microsoft Corporation.  All rights reserved.

 

 

Dump of file explorer.exe

 

File Type: EXECUTABLE IMAGE

 

  Image has the following delay load dependencies:

 

    netutils.dll

    wkscli.dll

    api-ms-win-security-sddl-l1-1-0.dll

    CRYPTSP.dll

    ole32.dll

    CFGMGR32.dll

    WINTRUST.dll

    Bcp47Langs.dll

    WINSTA.dll

    OLEACC.dll

    DUser.dll

    DUI70.dll

    SndVolSSO.DLL

    WinLangdb.dll

    MFPlat.DLL

    MF.dll

    SETTINGSYNCPOLICY.dll

    wlanapi.dll

    AppXAllUserStore.dll

    api-ms-win-appmodel-state-l1-2-0.dll

    ext-ms-win-ntuser-draw-l1-1-1.dll

    ext-ms-win-ntuser-draw-l1-1-2.dll

    ext-ms-win-rtcore-ntuser-window-ext-l1-1-0.dll

    api-ms-win-core-winrt-propertysetprivate-l1-1-1.dll

    api-ms-win-core-biplmapi-l1-1-1.dll

    dsreg.dll

    ext-ms-onecore-appmodel-veventdispatcher-l1-1-0.dll

    SystemEventsBrokerClient.dll

    api-ms-win-service-management-l1-1-0.dll

    api-ms-win-service-winsvc-l1-2-0.dll

    WINMM.dll

    UIAutomationCore.DLL

    SLC.dll

    XmlLite.dll

    api-ms-win-security-provider-l1-1-0.dll

 

  Image has the following dependencies:

 

    msvcrt.dll

    api-ms-win-core-libraryloader-l1-2-0.dll

    OLEAUT32.dll

    api-ms-win-eventing-provider-l1-1-0.dll

    api-ms-win-core-processthreads-l1-1-2.dll

    api-ms-win-core-debug-l1-1-1.dll

    api-ms-win-core-localization-l1-2-1.dll

    api-ms-win-core-synch-l1-2-0.dll

    api-ms-win-core-threadpool-l1-2-0.dll

    api-ms-win-core-com-l1-1-1.dll

    api-ms-win-core-errorhandling-l1-1-1.dll

    api-ms-win-core-handle-l1-1-0.dll

    api-ms-win-core-sysinfo-l1-2-1.dll

    api-ms-win-core-synch-l1-2-1.dll

    api-ms-win-core-registry-l1-1-0.dll

    api-ms-win-core-heap-l2-1-0.dll

    api-ms-win-core-winrt-string-l1-1-0.dll

    api-ms-win-core-heap-l1-2-0.dll

    api-ms-win-core-string-l1-1-0.dll

    api-ms-win-eventing-classicprovider-l1-1-0.dll

    api-ms-win-core-processenvironment-l1-2-0.dll

    api-ms-win-security-base-l1-2-0.dll

    api-ms-win-power-base-l1-1-0.dll

    api-ms-win-core-libraryloader-l1-2-1.dll

    api-ms-win-core-string-l2-1-1.dll

    api-ms-win-core-path-l1-1-0.dll

    api-ms-win-core-timezone-l1-1-0.dll

    api-ms-win-core-file-l1-2-1.dll

    api-ms-win-core-winrt-l1-1-0.dll

    api-ms-win-core-datetime-l1-1-1.dll

    api-ms-win-core-psapi-l1-1-0.dll

    api-ms-win-core-util-l1-1-0.dll

    api-ms-win-core-memory-l1-1-2.dll

    api-ms-win-core-interlocked-l1-2-0.dll

    api-ms-win-core-profile-l1-1-0.dll

    ntdll.dll

    api-ms-win-core-job-l2-1-0.dll

    api-ms-win-core-kernel32-private-l1-1-1.dll

    api-ms-win-core-registryuserspecific-l1-1-0.dll

    api-ms-win-core-com-private-l1-1-0.dll

    api-ms-win-core-atoms-l1-1-0.dll

    api-ms-win-core-url-l1-1-0.dll

    KERNEL32.dll

    USER32.dll

    GDI32.dll

    SHCORE.dll

    SHLWAPI.dll

    SHELL32.dll

    PROPSYS.dll

    UxTheme.dll

    dwmapi.dll

    TWINAPI.dll

    combase.dll

    d3d11.dll

    dcomp.dll

    api-ms-win-core-biptcltapi-l1-1-1.dll

    api-ms-win-core-biptcltapi-l1-1-3.dll

    api-ms-win-core-string-l2-1-0.dll

    SspiCli.dll

    api-ms-win-security-lsalookup-l2-1-1.dll

    api-ms-win-core-winrt-error-l1-1-1.dll

    api-ms-win-core-registry-l1-1-1.dll

    api-ms-win-core-io-l1-1-1.dll

    api-ms-win-eventing-controller-l1-1-0.dll

    api-ms-win-core-errorhandling-l1-1-3.dll

    USERENV.dll

    api-ms-win-core-file-l2-1-2.dll

    api-ms-win-service-management-l2-1-0.dll

    CRYPT32.dll

    api-ms-win-core-delayload-l1-1-1.dll

    api-ms-win-core-sidebyside-l1-1-0.dll

    api-ms-win-security-lsalookup-l1-1-2.dll

    MrmCoreR.dll

    api-ms-win-core-apiquery-l1-1-0.dll

    RPCRT4.dll

    profapi.dll

    api-ms-win-security-lsalookup-l1-1-1.dll

 

  Summary

 

        3000 .data

        1000 .didat

        8000 .idata

        1000 .imrsiv

       1A000 .reloc

      1EA000 .rsrc

      1CD000 .text

 

There is also a “visual” dependency walker that can be downloaded from here.  It provides the same functionality as DumpBin but it’s got a much nicer and better user interface. It provides access to Exported symbols too. The image depicted below belongs to GDI32.DLL

 

image

 

Happy coding!

 

Angel

Leave a Reply

Your email address will not be published. Required fields are marked *