What is LIEF Extended?

Introduction

LIEF extended is an enhanced version of LIEF that contains additional features like the support of Dyld shared cache, Objective-C metadata, PDB, and DWARF.

Whilst the main version of LIEF is focused on (only) providing support for ELF, PE, and Mach-O, LIEF extended aims at providing other functionalities that were not originally designed to be integrated into LIEF.

You can find the differences between both versions in this table:

Module

Regular Version

Extended Version

Note

ELF

PE

Mach-O

DEX

OAT

VDEX

ART

PDB

Support based on LLVM [1]

DWARF

Support based on LLVM [1]

ObjC

Support based on romainthomas/iCDump

Dyld Shared Cache

Disassembler

Support based on LLVM [1]

Assembler

Support based on LLVM [1]

To access the extended version, you must oauth-login with GitHub here: https://extended.lief.re/.

Once logged in, you can download the package of your choice (e.g. LIEF Extended - Python 3.10 for macOS arm64)

Versioning

LIEF extended uses a slightly different versioning scheme compared to the regular LIEF packages.

First off, every extended package is based on the current main branch of LIEF. If you need an (extended) build for a specific commit or tag, please contact extended@lief.re.

In Python, you can check the commit of LIEF being used in the extended version with:

# Make sure it's the extended version
$ python -c "import lief;print(lief.__extended__)"

# Print LIEF's main commit
$ python -c "import lief;print(lief.__LIEF_MAIN_COMMIT__)"
With the C++/Rust SDK you can call: to get details about the current version.

The additional features exposed by LIEF-extended are not always represented in a public commit while still being git-versioned. An incremental build number is attached to represent instal changes not associated with a (public) commit.

For instance, the version 0.16.0.2380 contains 10 commits more compared to the version 0.16.0.2370.

Python Wheels

Python packages are delivered as a wheel for the required platform/version (e.g. lief_extended-0.16.0.post2370-cp312-cp312-win_amd64.whl).

One can install this wheel with pip using either:

$ venv\Scripts\python.exe -m pip install C:\Users\tmp\lief_extended-0.16.0.post2370-cp312-cp312-win_amd64.whl

Or

$ venv\Scripts\python.exe -m pip install --find-links C:\Users\tmp\ lief_extended

You can check that LIEF extended is correctly installed with:

$ python -c "import lief;print(lief.__extended__)"
True

C++ SDK

The C++ SDK is delivered as a .zip/.tar.gz archive which contains:

  • A compiled shared library (libLIEF.so, LIEF.dll, libLIEF.dylib)

  • Header files

  • CMake helper files

Compared to the regular version, this SDK does not ship a static version of LIEF, and the shared library is compiled with all the extended functionalities.

Here is, for instance, the layout for the macOS arm64 SDK:

LIEF-extended-sdk-0.16.0.2378-Darwin-arm64/
  lib/libLIEF.dylib
  lib/cmake/LIEF/lief-extended-config-version.cmake
  include/[...]

Rust SDK

The Rust SDK is also delivered as a .zip/.tar.gz archive that contains all the files needed to be used with the LIEF_RUST_PRECOMPILED environment variable described in the Rust section.

Once the archive is extracted, you just have to set the environment variable LIEF_RUST_PRECOMPILED to the extracted path:

$ tar xzvf LIEF-extended-rust-0.16.0.2378-Linux-x86_64.tar.gz
  LIEF-extended-rust-0.16.0.2378-Linux-x86_64/rs/
  LIEF-extended-rust-0.16.0.2378-Linux-x86_64/rs/autocxx-autocxx_ffi-gen.rs
  LIEF-extended-rust-0.16.0.2378-Linux-x86_64/lib/
  LIEF-extended-rust-0.16.0.2378-Linux-x86_64/lib/libLIEF.so
  LIEF-extended-rust-0.16.0.2378-Linux-x86_64/lib/liblief-sys.a

$ export LIEF_RUST_PRECOMPILED=$(pwd)/LIEF-extended-rust-0.16.0.2378-Linux-x86_64

Then, you can enjoy all extended features in Rust:

$ cargo build my-lief-extended-projet

LIEF Extended & LLVM

LIEF extended relies on LLVM for some of its functionalities like the disassembler and the DWARF/PDB support.

The LLVM version used by LIEF is fully based on the upstream version and integrated into LIEF extended such that users don’t have to deal with the compilation of LLVM or its integration.

Note

LIEF is currently using LLVM 19.1.2.

Whenever it’s possible and suitable, bug fixes and enhancements have been PR-submitted to the LLVM project: