Skip to content

arm-32 JIT: misaligned jump table causes illegal instruction with arm_fp16 #8985

@alexreinking

Description

@alexreinking

Summary

On arm-32-linux with arm_fp16 enabled, certain JIT-compiled tests crash with SIGILL (illegal instruction). Investigation revealed that a jump table emitted by LLVM's JIT is misaligned by 2 bytes, causing jumps to land in the middle of an instruction.

Affected tests

  • correctness_float16_t
  • correctness_vector_reductions

These fail consistently on arm-32-linux with arm_fp16 across all LLVM versions (20, 21, 22, main) when running armhf binaries on an aarch64 host.

Root cause

LLVM's RTDyld (or ORC) emits a jump table that is only 2-byte aligned instead of 4-byte aligned when targeting arm-32 with arm_fp16. ARM 32-bit instructions must be 4-byte aligned. When the jump target is misaligned, the CPU executes garbage bytes and raises SIGILL.

The problem does not occur without the arm_fp16 feature enabled.

Reproduction

Run the affected tests on an aarch64 host with arm-32 cross-compilation and fp16:

cmake -G Ninja -S . -B build \
  -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.linux-arm32.cmake \
  -DHalide_TARGET=arm-32-linux-arm_fp16 \
  ...
ctest --test-dir build -R "correctness_float16_t|correctness_vector_reductions"

Next steps

  • Investigate whether this is a bug in LLVM's RTDyld or ORC JIT linker for ARM 32-bit
  • File upstream LLVM bug if confirmed
  • Consider whether Halide can work around the alignment issue

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions