Thursday, March 25, 2010

Shared libraries and ELF

I just finished reading How to write Shared Libraries by Ulrich Drepper, a very nice guide to understanding the details of dynamic linking and use of ELF format with Linux.
  • ELF structure like program header and segments
  • Clear explanation of GOT and PLT with concrete examples
  • Types of relocations: relative, symbol relocation and evils of TEXTREL
  • Tracing dynamic linking w/ LD_DEBUG
  • concept of gnu-hash style and backwards compatibility with -hash-style=both
  • attributes constuctor, destructor
  • common variables and -fno-common
  • controlling exported symbols with static / -fvisibility / attribute / #pragma visibility / export maps
  • symbol versioning: implementing backwards compatibility with a single dso: export maps and symver foo@VERS1 for past versions / symver foo@@VERS2 for the latest
  • dangers of depending on unfined symbols and -Wl,-z,defs
  • deprecated rpath vs runpath
  • relative paths to dso:s using dynamic string tokens like $ORIGIN
  • --as-needed to prune the list of DSO in DT_NEEDED

No comments:

Post a Comment