kobalicek bb47dc3ede Added a workaround to JitAllocator to work well with clang-17 UBSAN
LLVM's UBSAN (version 17) started using bytes below a function as
metadata for the sanitizer. It adds code to read this metadata when
performing an indirect function call, which means that if the function
itself is placed at a beginning of a mapped page, the application would
crash, because the previous page doesn't have to be accessible.

Unfortunately, LLVM exposes users to this implementation detail now,
and to make it possible to instrument software that links to asmjit,
a workaround had to be added. In addition, it's not just possible to
add this workaround to UBSAN builds, because asmjit can be installed
via a package and third party code that uses UBSAN can just link to
it. This means that we have to add padding to each block that provides
consecutive memory.

This behavior is now the default, however, an option exist:

  asmjit::JitAllocatorOptions::kDisableInitialPadding

With this option it's possible to control the behavior and to disable
the artificial padding used as a workaround.
2023-09-08 16:04:19 +02:00
2020-02-08 10:13:44 +01:00

AsmJit

AsmJit is a lightweight library for machine code generation written in C++ language.

See asmjit.com page for more details, examples, and documentation.

Documentation

Breaking Changes

Breaking the API is sometimes inevitable, what to do?

Project Organization

  • / - Project root.
    • src - Source code.
      • asmjit - Source code and headers (always point include path in here).
        • core - Core API, backend independent except relocations.
        • arm - ARM specific API, used only by ARM and AArch64 backends.
        • x86 - X86 specific API, used only by X86 and X64 backends.
    • test - Unit and integration tests (don't embed in your project).
    • tools - Tools used for configuring, documenting, and generating files.

TODO

  • Core:
    • Add support for user external buffers in CodeBuffer / CodeHolder.
  • Ports:
    • 32-bit ARM/Thumb port.
    • 64-bit ARM (AArch64) port.
    • RISC-V port.

Support

Notable Donors List:

Authors & Maintainers

Languages
C++ 93.2%
JavaScript 3.3%
C 3.2%
CMake 0.3%