Elftoolchain
The Elftoolchain project offers liberally-licensed tools and libraries for program development. The project has been in existence since 2008.
Home page: https://elftoolchain.sourceforge.io/.
News / Recent Posts
- Elftoolchain API changes - Jan 7, 2025
- New ELFTC(3) APIs - Jan 2, 2025
- Upcoming Opensource Work - Apr 28, 2022
- Elftoolchain v0.7.1 - Feb 20, 2016
- New release: ELF Toolchain v0.6.1 - Sep 25, 2012
Downstream Uses
Base System Imports
Elftoolchain has been designed to be suitable for inclusion into the base systems of OS projects. Examples of such uses include:
-
FreeBSD: contrib/elftoolchain — most tools and libraries.
-
Minix: external/bsd/elftoolchain —
libelfandlibdwarf. -
NetBSD: src/external/bsd/elftoolchain —
libelfandlibdwarf. -
OpenBSD: src/lib/libelf - only
libelf. -
RTEMS: rtems-tools/rtemstoolkit/elftoolchain —
libelf,libdwarfandlibelftc.
Other Imports
A few open-source projects that have imported Elftoolchain code into their source trees:
-
DynamoRIO: a runtime code manipulation system — in ext/drsyms.
-
Elastic’s EBPF: Elastic’s version of EBPF — in contrib/elftoolchain.
-
ravynOS: A FreeBSD-based operating system inspired by Mac OS X ™ — in contrib/elftoolchain.
As Installable Packages
Elftoolchain’s tools and libraries are also available as standalone packages:
-
Via Pkgsrc: devel/elftoolchain.
-
Via Macports: devel/elftoolchain.
Source Code
The project is hosted at SourceForge.Net.
Its source code can be checked out from: https://sourceforge.net/p/elftoolchain/code/HEAD/tree/trunk.
Documentation
Project Wiki
Please see https://elftoolchain.sourceforge.io/.
Articles
(Tutorial) Libelf by Example
This is a short introduction to libelf, a library for manipulating
ELF objects.
It covers:
-
Getting started with libelf: obtaining a handle to an ELF object, establishing a working ELF version, and handling errors reported by libelf.
-
How ELF data structures are laid out in-memory and on disk, the notions of "file representation" and "memory representation", how to write applications that can handle non-native binaries.
-
ELF Segments and the ELF Program Header Table, retrieving the program header table from an ELF executable and the meaning of the fields of a program header table entry.
-
How data is stored inside ELF sections, the ELF Section Header Table, and how to traverse the sections in an ELF object.
-
How to create new ELF objects: the rules for ordering individual API calls, the default object layout implemented by libelf, and how to specify custom layouts.
-
ararchives: their structure, and how to read the contents of these archives using the APIs provided by libelf.
Download Links
-
Libelf by Example (at Leanpub).
-
Libelf by Example (at SourceForge).
Books
The ELF Handbook
Reference material for ELF. Please see: A Handbook For ELF.