Samir Shetty 0d9567f08c Fix build compatibility with CMake 4, GCC 15, and MSVC (#600)
* Support building with CMake 4

Adapted from https://github.com/NixOS/nixpkgs/pull/450265

* Support building with GCC 15

Adapted from https://github.com/NixOS/nixpkgs/pull/450265

* Fix building with MSVC

* RISCV: Add RegSize/Alignment fields to RISCVGenRegisterInfo.inc initializers

Keystone's MCRegisterClass retains the RegSize and Alignment fields from
the LLVM 4.0 era, before they were moved to TargetRegisterInfo in LLVM 5.0
(D31783) and eventually removed from MCRegisterClass entirely in LLVM 7.0
(rL339350).

The RISCV backend was ported from a newer LLVM snapshot where these fields
no longer existed, so RISCVGenRegisterInfo.inc was generated without them,
causing a member count mismatch against keystone's MCRegisterClass definition
and a compile error on MSVC (C3852).

Add the missing RegSize and Alignment values to each register class
initializer to match the layout expected by MCRegisterClass. The values
chosen reflect the natural register width of each class (4 bytes for FPR32,
8 bytes for all others). These fields are structurally required to satisfy
the initializer but are never consulted by the assembler — spill slot
calculations belong to the codegen layer which keystone does not include.

All other architectures in keystone were ported from pre-LLVM-5.0 and have
correct initializers. This change makes RISCV consistent with them.
2026-07-18 17:28:10 -04:00
2020-06-14 01:45:32 +08:00
2023-05-15 13:58:12 +02:00
2016-05-02 01:48:57 +08:00
2023-03-28 14:09:12 +02:00
2020-06-18 22:26:14 +08:00
2016-04-28 21:06:49 +08:00
2020-06-21 20:03:54 +08:00
2016-04-28 21:06:49 +08:00
2016-04-28 21:06:49 +08:00
2016-05-31 09:13:53 +08:00
2016-05-24 18:23:20 +02:00
2023-03-28 13:06:34 +02:00
2020-06-10 16:02:14 +08:00
2016-04-28 21:06:49 +08:00

Keystone Engine

Build Status Build Status Build status

Keystone is a lightweight multi-platform, multi-architecture assembler framework. It offers some unparalleled features:

  • Multi-architecture, with support for Arm, Arm64 (AArch64/Armv8), Ethereum Virtual Machine, Hexagon, Mips, PowerPC, RISC-V, Sparc, SystemZ & X86 (include 16/32/64bit).
  • Clean/simple/lightweight/intuitive architecture-neutral API.
  • Implemented in C/C++ languages, with bindings for Java, Masm, C#, PowerShell, Perl, Python, NodeJS, Ruby, Go, Rust, Haskell, VB6 & OCaml available.
  • Native support for Windows & *nix (with Mac OSX, Linux, *BSD & Solaris confirmed).
  • Thread-safe by design.
  • Open source - with a dual license.

Keystone is based on LLVM, but it goes much further with a lot more to offer.

Further information is available at http://www.keystone-engine.org

License

Keystone is available under a dual license:

  • Version 2 of the GNU General Public License (GPLv2). (I.e. Without the "any later version" clause.). License information can be found in the COPYING file and the EXCEPTIONS-CLIENT file.

    This combination allows almost all of open source projects to use Keystone without conflicts.

  • For commercial usage in production environments, contact the authors of Keystone to buy a royalty-free license.

    See LICENSE-COM.TXT for more information.

Compilation & Docs

See COMPILE.md file for how to compile and install Keystone.

More documentation is available in docs/README.md.

Contact

Contact us via mailing list, email or twitter for any questions.

Contribute

Keystone is impossible without generous support from our sponsors. We cannot thank them enough!

CREDITS.TXT records other important contributors of our project.

If you want to contribute, please pick up something from our Github issues.

We also maintain a list of more challenged problems in a TODO list.

S
Description
Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings
Readme
46 MiB
Languages
C++ 93.3%
OCaml 1.6%
CMake 1.2%
Python 1.2%
C 1%
Other 1.2%