Changed files: ``` M Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.cc M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.hh M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.hh M Ghidra/Features/Decompiler/src/decompile/cpp/database.cc M Ghidra/Features/Decompiler/src/decompile/cpp/database.hh M Ghidra/Features/Decompiler/src/decompile/cpp/float.cc M Ghidra/Features/Decompiler/src/decompile/cpp/float.hh M Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/flow.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_block.cc M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc M Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc M Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh M Ghidra/Features/Decompiler/src/decompile/cpp/merge.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.hh M Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc M Ghidra/Features/Decompiler/src/decompile/cpp/translate.hh M Ghidra/Features/Decompiler/src/decompile/cpp/type.cc M Ghidra/Features/Decompiler/src/decompile/cpp/type.hh M Ghidra/Features/Decompiler/src/decompile/cpp/unionresolve.cc M Ghidra/Features/Decompiler/src/decompile/cpp/unionresolve.hh M Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc M Ghidra/Processors/8051/certification.manifest M Ghidra/Processors/8051/data/languages/8051_main.sinc A Ghidra/Processors/8051/data/languages/cip-51.slaspec A Ghidra/Processors/8051/data/languages/keil-cx51.cspec M Ghidra/Processors/ARM/data/languages/ARM.sinc M Ghidra/Processors/ARM/data/languages/ARMTHUMBinstructions.sinc M Ghidra/Processors/ARM/data/languages/ARMneon.sinc M Ghidra/Processors/PIC/data/languages/pic18_instructions.sinc M Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc ``` Commit details: ``` [Commit 1/15] Hash: 9e18f9439e54f13d31c9fb2b7de373415849150b Date: 2026-04-29 12:40:29 +0000 Message: GP-0: Fixed missing define statement Files changed: M Ghidra/Processors/8051/data/languages/8051_main.sinc [Commit 2/15] Hash: e12d821d861ec31266367d37ee7ed0aabaaf02ec Date: 2026-02-26 19:53:42 +0000 Message: GP-6492 Adjustments to union scoring Files changed: M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.cc M Ghidra/Features/Decompiler/src/decompile/cpp/constseq.hh M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.hh M Ghidra/Features/Decompiler/src/decompile/cpp/database.cc M Ghidra/Features/Decompiler/src/decompile/cpp/database.hh M Ghidra/Features/Decompiler/src/decompile/cpp/float.cc M Ghidra/Features/Decompiler/src/decompile/cpp/float.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.cc M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc M Ghidra/Features/Decompiler/src/decompile/cpp/merge.cc M Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/subflow.hh M Ghidra/Features/Decompiler/src/decompile/cpp/type.cc M Ghidra/Features/Decompiler/src/decompile/cpp/type.hh M Ghidra/Features/Decompiler/src/decompile/cpp/unionresolve.cc M Ghidra/Features/Decompiler/src/decompile/cpp/unionresolve.hh M Ghidra/Features/Decompiler/src/decompile/cpp/variable.cc [Commit 3/15] Hash: d2279118771dd1b503a5efaaaffe772405136290 Date: 2026-04-27 14:04:48 -0400 Message: GP-6333: Fix for ARM Thumb to prevent misaligned branches Files changed: M Ghidra/Processors/ARM/data/languages/ARM.sinc M Ghidra/Processors/ARM/data/languages/ARMTHUMBinstructions.sinc [Commit 4/15] Hash: 741b69d9090262eb0031d92c79cd19bd6b618b93 Date: 2026-03-05 18:55:32 +0000 Message: GP-6538 Don't assume slot == 1 in for RETURN Files changed: M Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc [Commit 5/15] Hash: 4bec0d1809f80c2231d51def60ee334bdec91dba Date: 2026-04-24 15:49:42 +0000 Message: GP-6610 Add count of jumptable recover stages Files changed: M Ghidra/Features/Decompiler/src/decompile/cpp/flow.cc M Ghidra/Features/Decompiler/src/decompile/cpp/flow.hh M Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_block.cc M Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc M Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh [Commit 6/15] Hash: 2b4efbfd681a79a4cd1cd8a962c78beba9b9e2ea Date: 2026-04-22 18:12:49 +0000 Message: GP-6750: Fixed disassembly error for ARM neon simdExpImm_16 Files changed: M Ghidra/Processors/ARM/data/languages/ARMneon.sinc [Commit 7/15] Hash: def6a8d4f962028826446503dd37d333c284cba8 Date: 2026-03-23 16:01:25 +0000 Message: GP-6000: Updated certification for Processor 8051 Files changed: M Ghidra/Processors/8051/certification.manifest [Commit 8/15] Hash: 3f5b0be75d7ef8e1956e371f47f0e623dd6e56a0 Date: 2026-01-06 17:39:36 -0500 Message: Add 8051 CIP-51 (Silicon Labs) processor support and Keil C51 compiler specification Details: - Add CIP51 variant support to 8051_main.sinc with extended SFR addressing (2-byte) - Add IFLASH and XRAM address spaces for CIP-51 memory model - Add cip-51.slaspec for CIP-51 processor definition - Add keil-cx51.cspec for Keil C51 compiler calling conventions Files changed: M Ghidra/Processors/8051/data/languages/8051_main.sinc A Ghidra/Processors/8051/data/languages/cip-51.slaspec A Ghidra/Processors/8051/data/languages/keil-cx51.cspec [Commit 9/15] Hash: aeba87cceeecbb09257a20da606f92f3b5dbd844 Date: 2026-03-19 16:07:09 +0000 Message: GP-6591: PIC-18 destReg banked register disassembly fix Files changed: M Ghidra/Processors/PIC/data/languages/pic18_instructions.sinc [Commit 10/15] Hash: ac09f8638339d431f339c5a024b779c15e463a94 Date: 2026-03-04 12:05:06 +0000 Message: GP-5508: Remove unused token pieces Files changed: M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc [Commit 11/15] Hash: ab08578711be63ccac23a2824caa3b9987544322 Date: 2024-11-24 14:55:06 +0100 Message: Fix PPC STQ negative offsets Files changed: M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc [Commit 12/15] Hash: 65a848c4d1956c64a0910b4a85bfcd16c8c9b3ed Date: 2024-11-24 14:44:21 +0100 Message: Reusing dqPlusRaOrZeroAddress for EA calculation Files changed: M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc [Commit 13/15] Hash: 86c31bb5d8e0552ab19948515ba0acdd230fbbbe Date: 2024-11-24 14:27:16 +0100 Message: Removed PPCAS-specific decoding Files changed: M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc [Commit 14/15] Hash: 2037480b4e2da8812b7734f0c9111f38b6c9b8a8 Date: 2024-08-19 10:22:07 +0100 Message: Fix LQ instruction to support signed offsets Details: Based on the Power ISA manual sign extended DQ<<4 is added to RA to get source EA. Files changed: M Ghidra/Processors/PowerPC/data/languages/ppc_common.sinc M Ghidra/Processors/PowerPC/data/languages/ppc_isa.sinc [Commit 15/15] Hash: a1e0d3cd81a75e3648381cd7c1d816dabf4e5c57 Date: 2025-09-08 17:58:32 +0000 Message: GP-3330 Add support stack storage in joined varnodes Files changed: M Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc M Ghidra/Features/Decompiler/src/decompile/cpp/translate.cc M Ghidra/Features/Decompiler/src/decompile/cpp/translate.hh ``` Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sleigh Library
Sleigh is a language used to describe the semantics of instruction sets of general-purpose microprocessors, with enough detail to facilitate the reverse engineering of software compiled for these architectures. It is part of the Ghidra reverse engineering platform and underpins two of its major components: its disassembly and decompilation engines.
This repository provides a CMake-based build project for Sleigh so that it can be built and packaged as a standalone library and be reused in projects other than Ghidra.
Supported Platforms
| Name | Support |
|---|---|
| Linux | Yes |
| macOS | Yes |
| Windows | Yes |
Dependencies and Prerequisites
Required
| Name | Version | Linux Package to Install | macOS Homebrew Package to Install |
|---|---|---|---|
| (HEAD builds) zlib | Recent | zlib1g-dev | zlib |
| Git | Latest | git | N/A |
| CMake | 3.18+ | cmake | cmake |
NOTE: This CMake project pulls the Ghidra source code from the internet during configuration. See the note on Ghidra source code section for more details.
Optional
For building documentation:
| Name | Version | Linux Package to Install | macOS Homebrew Package to Install |
|---|---|---|---|
| Doxygen | Latest | doxygen | doxygen |
| GraphViz | Latest | graphviz | graphviz |
Build and Install the Sleigh Library
# Clone this repository (CMake project for sleigh)
git clone https://github.com/lifting-bits/sleigh.git
cd sleigh
# Configure CMake
cmake -B build -S .
# Build Sleigh
cmake --build build --parallel 8
# Install Sleigh
cmake --install build --prefix ./install
Note on Ghidra source code
The Ghidra source code is not actually included in this git repo, and by default, CMake will automatically pull a stable version from the internet for you.
Please see src/README.md for more information on how to customize which Ghidra source code commit will be used/compiled, including specifying your own local copy of the Ghidra source.
Packaging
The CMake configuration also supports building packages for Sleigh.
For example:
# Package Sleigh
cmake --build build --target package
API Usage
An example program called sleigh-lift has been included to demonstrate how to use the Sleigh API. It takes a hexadecimal string of bytes and can disassemble it or lift it to p-code. The program can be invoked as follows, where the action argument must be either disassemble or pcode:
sleigh-lift [action] [sla_file] [bytes] [-a address] [-p root_sla_dir] [-s pspec_file]
For example, to disassemble the following byte string:
$ sleigh-lift disassemble x86-64.sla 4881ecc00f0000
0x00000000: SUB RSP,0xfc0
And to lift it to p-code:
$ sleigh-lift pcode x86-64.sla 4881ecc00f0000
(register,0x200,1) = INT_LESS (register,0x20,8) (const,0xfc0,8)
(register,0x20b,1) = INT_SBORROW (register,0x20,8) (const,0xfc0,8)
(register,0x20,8) = INT_SUB (register,0x20,8) (const,0xfc0,8)
(register,0x207,1) = INT_SLESS (register,0x20,8) (const,0x0,8)
(register,0x206,1) = INT_EQUAL (register,0x20,8) (const,0x0,8)
(unique,0x12c00,8) = INT_AND (register,0x20,8) (const,0xff,8)
(unique,0x12c80,1) = POPCOUNT (unique,0x12c00,8)
(unique,0x12d00,1) = INT_AND (unique,0x12c80,1) (const,0x1,1)
(register,0x202,1) = INT_EQUAL (unique,0x12d00,1) (const,0x0,1)
If you do not want to build sleigh-lift, you must set the CMake variable sleigh_BUILD_EXTRATOOLS option to OFF during CMake configuration.
Helpers
This repository contains a helper not part of Sleigh/Ghidra, which you can find in the support directory. It has the following signature and can help the user find the location of a given spec file on the system:
std::optional<std::filesystem::path>
FindSpecFile(std::string_view file_name,
const std::vector<std::filesystem::path> &search_paths =
gDefaultSearchPaths);
The sleigh::FindSpecFile function will search the paths provided by the user via the search_paths argument for a spec file with the name file_name. The default argument for search_paths is sleigh::gDefaultSearchPaths which contains the install/build directories generated during CMake configuration and a set of common installation locations.
If you do not want to build the helpers, you must set the CMake variable sleigh_BUILD_SUPPORT option to OFF during CMake configuration.
Integration as a Dependency
An installation of Sleigh provides a CMake interface that you can use when building your project.
You can find an example of how to use the CMake package config file in the find_package example.
We also provide a CMake helper function sleigh_compile to compile your .slaspec files using a sleigh compiler.
You can find a more complex CMake example with compiling Sleigh specifications in the example directory, which uses the upstream-provided sleigh example source code.
Lastly, you can locate the installed compiled sleigh files through the CMake variable sleigh_INSTALL_SPECDIR, which is an absolute path to the root directory for the compiled sleigh files---you should manually inspect this to know what to expect.
Referencing the CMake config file and specfiles CMake file is also suggested for learning more about the exposed CMake variables and modules.
License
See the LICENSE file.