GSoC2008 Stefan Notes

From Syslinux Wiki
Jump to: navigation, search

Notes: Stefan Bucur, Dynamic Module Loading Using the ELF Format

General Notes

  • While searching through glibc source code, I found a very neat piece of code that checks whether a number is a power of two. I've never thought of this before:
/* Must be a power of two.  */
   assert ((bitmask_nwords & (bitmask_nwords - 1)) == 0);

Useful git techniques

  • After you got a little familiar with Git (by reading the tutorial, for instance) and started using it for your project, there might be moments when you feel the need of a more advanced overview of the Git workflow. In that case, I recommend Git in a Nutshell. It briefly explains again the stuff covered in the tutorial, then continues with more advanced techniques that are very likely to be useful for most developers.

ELF format notes and links

The list below contains sporadic information regarding the ELF format interpretation. As the list grows, I will better organize the items so that one could easily skim through. This list will also be a starting point for a more complete documentation.

  • The ultimate source of ELF documentation: http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
  • A nicely put together document from the organization that standardized the latest version of ELF: http://x86.ddj.com/ftp/manuals/tools/elf.pdf
  • The Linux command readelf is the perfect tool for inspecting ELF objects.
    • readelf -l shows program segment information.
    • readelf -s shows symbol information - there are usually two symbol tables shown, one of them containing symbols pertaining only to dynamic linking - exported symbols, unsatisfied dependencies.
    • readelf -r shows relocation information.
  • The Linux command objdump -p sharedobject can also be used to show all the program headers and symbol information in an ELF shared object.
  • Some specifications regarding the GNU Hash section (that is said to improve symbol lookup performance by 50%) can be found here: http://sourceware.org/ml/binutils/2006-10/msg00377.html
  • The ld documentation is very valuable as it teaches how to craft almost every type of binary with great flexibility.

See also