AlphaOmega.ElfReader 1.1.85

dotnet add package AlphaOmega.ElfReader --version 1.1.85
                    
NuGet\Install-Package AlphaOmega.ElfReader -Version 1.1.85
                    
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="AlphaOmega.ElfReader" Version="1.1.85" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AlphaOmega.ElfReader" Version="1.1.85" />
                    
Directory.Packages.props
<PackageReference Include="AlphaOmega.ElfReader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AlphaOmega.ElfReader --version 1.1.85
                    
#r "nuget: AlphaOmega.ElfReader, 1.1.85"
                    
#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.
#:package AlphaOmega.ElfReader@1.1.85
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AlphaOmega.ElfReader&version=1.1.85
                    
Install as a Cake Addin
#tool nuget:?package=AlphaOmega.ElfReader&version=1.1.85
                    
Install as a Cake Tool

ELF Reader

Auto build NuGet NuGet Downloads

Executable and Linkable Format (ELF) reader / parser for .NET.

Targets: net35, netstandard2.0 (usable on modern .NET via netstandard2.0).


Features

  • Parse ELF32 / ELF64 headers
  • Endianness aware (LSB / MSB)
  • Enumerate sections, symbols, notes, string tables
  • Read relocations (REL & RELA)
  • Access raw section bytes (except NOBITS)
  • Strongly typed enums / structs mirroring spec
  • Pure managed code (no native dependency)

Installation

dotnet add package AlphaOmega.ElfReader

Or

Install-Package AlphaOmega.ElfReader

Quick Start

using AlphaOmega.Debug;
using(var elf = new ElfFile(StreamLoader.FromFile(@"/usr/lib/libc.so.6")))
{
    if(!elf.Header.IsValid) return;

    // Sections
    foreach(var s in elf.Sections)
        Console.WriteLine($"[{s.Index}] {s.Name} Type={s.sh_type} Size=0x{s.sh_size:X}");

    // Symbols (SYMTAB + DYNSYM)
    foreach(var symSec in elf.GetSymbolSections())
        foreach(var sym in symSec)
            Console.WriteLine($"SYM {sym.Name} Bind={sym.Bind} Type={sym.Type} Vis={sym.Visibility}");

    // Relocations (no addend)
    foreach(var relSec in elf.GetRelocationSections())
        foreach(var rel in relSec) { /* process */ }

    // Relocations with addend
    foreach(var relaSec in elf.GetRelocationASections())
        foreach(var rela in relaSec) { /* process */ }

    // Notes
    foreach(var noteSec in elf.GetNotesSections())
        foreach(var note in noteSec)
            Console.WriteLine($"NOTE {note.Name} Type={note.Type} Size={note.Desc?.Length}");
}

API Overview

  • Header – ELF header wrapper (IsValid, Is64Bit)
  • Sections – Parsed section headers
  • SectionNames – Section name string table (if present)
  • GetStringSections() – STRTAB enumerators
  • GetNotesSections() – NOTE sections
  • GetSymbolSections() – SYMTAB / DYNSYM combined helper
  • GetRelocationSections() – REL
  • GetRelocationASections() – RELA
  • Section.GetData() – Raw bytes (except NOBITS)

Typical Workflow

  1. Open file via StreamLoader / custom IImageLoader
  2. Validate header
  3. Enumerate sections or filter by type
  4. Enumerate symbols / relocations / notes
  5. Read raw data for custom parsing

Safety

Only structural parsing performed. Validate offsets / sizes for untrusted input.

Limitations / TODO

  • Program headers (segments) helper not implemented
  • Architecture-specific relocation interpretation left to caller
  • DWARF / debug info not parsed

Original minimal sample:

using(ElfFile file = new ElfFile(StreamLoader.FromFile(@"C:\Test\libmono.so")))
{
    if(file.Header.IsValid)
    {
        foreach(var strSec in file.GetStringSections())
            foreach(var str in strSec)
                //...

        foreach(var noteSec in file.GetNotesSections())
            foreach(var note in noteSec)
                //...

        foreach(var symbolSec in file.GetSymbolSections())
            foreach(var symbol in symbolSec)
                //...

        foreach(var relSec in file.GetRelocationSections())
            foreach(var rel in relSec)
                //...

        foreach(var relaSec in file.GetRelocationASections())
            foreach(var rela in relaSec)//TODO: Check it
                //...

        SymbolSection symbols = file.GetSymbolSections().FirstOrDefault();
        if(symbols != null)
            //...
    }
}
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.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net35 is compatible.  net40 was computed.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 3.5

    • No dependencies.
  • .NETStandard 2.0

    • 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
1.1.85 256 10/28/2025
1.1.84 269 11/18/2024
1.0.8415.27252 429 1/15/2023