LibObjectFile 0.4.0

.NET Standard 2.1
dotnet add package LibObjectFile --version 0.4.0
NuGet\Install-Package LibObjectFile -Version 0.4.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LibObjectFile" Version="0.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LibObjectFile --version 0.4.0
#r "nuget: LibObjectFile, 0.4.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LibObjectFile as a Cake Addin
#addin nuget:?package=LibObjectFile&version=0.4.0

// Install LibObjectFile as a Cake Tool
#tool nuget:?package=LibObjectFile&version=0.4.0

LibObjectFile Build Status NuGet

<img align="right" width="200px" height="200px" src="">

LibObjectFile is a .NET library to read, manipulate and write linker and executable object files (e.g ELF, ar, DWARF, COFF...)

NOTE: Currently LibObjectFile supports only the following file format:

  • ELF object-file format
  • DWARF debugging format (version 4)
  • Archive ar file format (Common, GNU and BSD variants)

There is a longer term plan to support other file formats (e.g COFF, MACH-O, .lib) but as I don't have a need for them right now, it is left as an exercise for PR contributors! 😉


// Reads an ELF file
using var inStream = File.OpenRead("helloworld");
var elf = ElfObjectFile.Read(inStream);
foreach(var section in elf.Sections)
// Print the content of the ELF as readelf output
// Write the ElfObjectFile to another file on the disk
using var outStream = File.OpenWrite("helloworld2");


  • Full support of Archive ar file format including Common, GNU and BSD variants.
  • Good support for the ELF file format:
    • Read and write from/to a System.IO.Stream
    • Handling of LSB/MSB
    • Support the following sections:
      • String Table
      • Symbol Table
      • Relocation Table: supported I386, X86_64, ARM and AARCH64 relocations (others can be exposed by adding some mappings)
      • Note Table
      • Other sections fallback to ElfCustomSection
    • Program headers with or without sections
    • Print with readelf similar output
  • Support for DWARF debugging format:
    • Partial support of Version 4 (currently still the default for GCC)
    • Support for the sections: .debug_info, .debug_line, .debug_aranges, .debug_abbrev and .debug_str
    • Support for Dwarf expressions
    • High level interface, automatic layout/offsets between sections.
    • Integration with ELF to support easy reading/writing back
    • Support for relocatable sections
  • Use of a Diagnostics API to validate file format (on read/before write)
  • Library requiring .NET netstandard2.1+ and compatible with netcoreapp3.0+


The doc/ explains how the library is designed and can be used.

Known Issues

PR Welcome if you are willing to contribute to one of these issues:

  • Add more unit tests


There are still a few missing implementation of ElfSection for completeness:

  • Dynamic Linking Table (SHT_DYNAMIC)
  • Version Symbol Table (SHT_VERSYM)
  • Version Needs Table (SHT_VERNEED)

These sections are currently loaded as ElfCustomSection but should have their own ElfXXXTable (e.g ElfDynamicLinkingTable, ElfVersionSymbolTable...)


  • Version 4: support for .debug_types, .debug_frame, .debug_loc, .debug_ranges, .debug_pubnames, .debug_pubtypes, .debug_macinfo section
  • Version 5

Other file formats

In a future version I would like to implement the following file format:

  • COFF
  • Mach-O
  • Portable in Memory file format to easily convert between ELF/COFF/Mach-O file formats.


LibObjectFile is available as a NuGet package: NuGet


In order to build LibObjectFile, you need to have installed the .NET Core 3.0 SDK.

Running the tests require Ubuntu 18.04. dotnet test will work on Windows (via WSL) and on that version of Ubuntu. If you're using macOS or another Linux, there's a Dockerfile and a helper script under src to run tests in the right OS version.


This software is released under the BSD-Clause 2 license.


Alexandre MUTEL aka xoofx


Supports this project with a monthly donation and help me continue improving it. [Become a supporter]

<img src="" width="64px;" style="border-radius: 50%" alt="bruno-garcia"/>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.0 1,131 10/21/2022
0.3.6 639 3/6/2022
0.3.5 878 2/11/2020
0.3.4 479 1/4/2020
0.3.3 415 12/24/2019
0.3.2 449 12/22/2019
0.3.1 434 12/19/2019
0.3.0 444 12/18/2019
0.2.1 434 11/19/2019
0.2.0 423 11/17/2019
0.1.0 436 11/16/2019