Analyze Statically Linked Binaries on Linux* Targets

To profile a statically linked binary file, temporary stop stripping the binary file during compilation and make sure the binary file exports the following symbols from system libraries:

  • _init() in the main executable: if you profile a tree of processes, consider using the strategy option.


    • A target exports setenv, getenv(), and __errno_location() symbols unconditionally.

    • If a target employs recv() API, it exports recv() and poll().

    • If a target employs sleep() or usleep() APIs, it exports sleep() or usleep() respectively, and nanosleep() symbol.


    • If a target employs pthread_create() API, it exports the following symbols:

      • pthread_create()

      • pthread_key_create()

      • pthread_setspecific()

      • pthread_getspecific()

      • pthread_self()

      • pthread_getattr_np()

      • pthread_attr_destroy()

      • pthread_attr_setstack()

      • pthread_attr_getstack()

      • pthread_attr_getstacksize()

      • pthread_attr_setstacksize()

      • If a target employs pthread_cancel() API, it exports the following symbols:

        • pthread_cancel()

        • _pthread_cleanup_push()

        • _pthread_cleanup_pop()

      • If a target employs _pthread_cleanup_push() or _pthread_cleanup_pop() API, it exports the following symbols:

        • _pthread_cleanup_push()

        • _pthread_cleanup_pop()

      • If a target employs pthread_mutex_lock() API, it exports pthread_mutex_lock() and pthread_mutex_trylock() symbol.

      • If a target employs pthread_spin_lock() API, it exports pthread_spin_lock() and pthread_spin_trylock() symbol.


    If a target employs any of dlopen(), dlsym(), or dlclose() APIs, it exports all three of them simultaneously.

If the binary file does not export some of the symbols above, use the -u linker switch (for example, specify -Wl,-u__errno_location if you use compiler for linking) to include symbols into the binary file at the linking stage of compilation.

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)