RepositoryC#FRFrance
xoofx

xoofx/LibObjectFile

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

184stars
17forks
9issues
5views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: elf

#1 Repository of the month

1
TINIX TRENDING·Topic: pe-file

#1 Repository of the month

1
TINIX TRENDING·Topic: dwarf

#1 Repository of the month

LibObjectFile ci NuGet

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

NOTE: Currently LibObjectFile supports the following file format:

  • PE image file format (Portable Executable / DLL)
  • 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! ;)

Usage

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

Features

  • Full support of Archive ar file format including Common, GNU and BSD variants.
  • Full support for the PE file format
    • Support byte-to-byte roundtrip
    • Read and write from/to a System.IO.Stream
    • All PE Directories are supported
    • PEFile.Relocate to relocate the image base of a PE file
    • PEFile.Print to print the content of a PE file to a textual representation
    • Support for calculating the checksum of a PE file
  • Good support for the ELF file format:
    • Support byte-to-byte roundtrip
    • 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 net8.0
    • If you are looking for netstandard2.1 support you will need to use 0.4.0 version

Documentation

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

Download

LibObjectFile is available as a NuGet package: NuGet

Build

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

Running the tests require Ubuntu 22.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.

License

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

Author

Alexandre MUTEL aka xoofx

Supporters

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

bruno-garcia

Similar Projects

Discover other similar projects and AI models.

RepositoryC#
jellyfin/jellyfin

The Free Software Media System - Server Backend & API

60.0k
Dec 1, 2026
RepositoryC#
KnifeLemon/Filee

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

33.3k
Dec 2, 2026
RepositoryC#
AvaloniaUI/Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The future of .NET UI

31.9k
Nov 27, 2026
RepositoryC#
BeyondDimension/SteamTools

🛠「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。

27.9k
Dec 1, 2026
RepositoryC#
bitwarden/server

Bitwarden infrastructure/backend (API, database, Docker, etc).

20.8k
Dec 1, 2026
RepositoryC#
ardalis/CleanArchitecture

Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10

18.6k
Dec 1, 2026
RepositoryC#
OpenRA/OpenRA

Open Source real-time strategy game engine for early Westwood games such as Command & Conquer: Red Alert written in C# using SDL and OpenGL. Runs on Windows, Linux, *BSD and Mac OS X.

17.9k
Nov 22, 2026
RepositoryC#
MonoGame/MonoGame

One framework for creating powerful cross-platform games.

14.7k
Nov 30, 2026
RepositoryC#
winsw/winsw

A wrapper executable that can run any executable as a Windows service, in a permissive license.

14.5k
Dec 1, 2026