This is an old revision of the document!


LibElf

LibElf is project implementing a BSD-licensed implementation of the SVR4 [http://www.freebsd.org/cgi/man.cgi?query=elf&apropos=0&sektion=0&manpath=SunOS+5.10&format=html ELF(3)] API. The scope of the project includes:

JosephKoshy is the developer working on this project.

In the absence of a common API to read and manipulate ELF objects, many of FreeBSD's tools implement ad-hoc ELF parsers inside themselves.

FreeBSD tools which implement ad-hoc parsers include:

  • btxld(8): reads and parses the ELF header when loading files.
  • elfdump(1): displays information about ELF files.
  • gprof(1): reporting tool for cc -pg profiling.
  • kgzip(8): compresses a kernel.
  • pmcstat(8): performance monitoring controller for PMC based profiling.

The downside of implementing ad-hoc ELF parsers is:

  • the extra effort in developing & maintaining the parser code,
  • parsing bugs that weaken the quality of the overall system,
  • the added difficulty in making such tools cross-platform.

The use of a common ELF API alleviates these problems to some degree.

The GNU binutils toolset implements one such common API; the [http://sources.redhat.com/binutils/ Binary File Descriptor] library (-lbfd). The BFD library supports a very large range of cross-targets. However, its implementation is distributed under a restrictive license (GPL, not even LGPL), which makes it unsuitable for use in developing BSD-licensed tools.

The SVR4 ELF(3) API implements architecture-independent parsing of ELF files. While its scope is narrower than that of BFD, it fits FreeBSD's needs reasonably well. Apart from (Open)Solaris code, a small number of 3rd-party open-source applications use this API.

The ERTOS project's [http://www.ertos.nicta.com.au/software/kenge/libelf/devel/ ELF library] can also handle ELF files, but offers an API different from ELF(3).

The ELF(3) API seems to have first appeared in SysV Unix (namely, SVR4), As the API evolved, it developed 32 and 64 bit variants. The [http://www.freebsd.org/cgi/man.cgi?query=gelf&apropos=0&sektion=0&manpath=SunOS+5.10&format=html GELF(3)] sub-API was added to provide an ELF class-independent way of manipulating ELF files.

ELF(3) is currently in use in Solaris and other SVR4 derived systems. An LGPL-ed implementation of this API is present in some GNU operating systems.

LibElf is being developed in FreeBSD's CVS repository.

CVS: [http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libelf/ http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libelf/]

Design notes are on a seperate page: LibElf/ImplementationNotes. A 'status' page is at: LibElf/ImplementationStatus.

Native toolchain work is being tracked at ElfToolChain.

External Projects

The following people/projects are using FreeBSD's LibElf:

  • libelf.1200460230.txt.gz
  • Last modified: 2008/01/16 05:10
  • by JosephKoshy