Skip to content

Emit native test objects with the JIT target machine - #929

Merged
maleadt merged 1 commit into
mainfrom
tb/jit-objects
Sep 9, 2026
Merged

maleadt merged 1 commit into
mainfrom
tb/jit-objects

Conversation

@maleadt

@maleadt maleadt commented Sep 9, 2026

Copy link
Copy Markdown
Member

Test-infrastructure fix split out of #926.

The native test helper's mcgen override only used JITTargetMachine for :patch and :table jobs; :bake objects fell through to the stock target machine, which uses the small code model with static relocations. Objects built that way only work when loaded below 2 GiB, which ORC does not guarantee:

  • Linux, Julia 1.12: JITLink rejects the object with relocation target .rodata.cst32 ... is out of range of Pointer32Signed fixup as soon as the code has a constant pool.
  • Linux, Julia 1.10/1.11: older JITLink has no range check, the truncated address is used, and the test worker segfaults.
  • Windows: the stock machine emits COFF while the ORC JIT is configured for ELF (JITTargetMachine appends -elf to the triple), giving garbage return values and a later crash in LLVMOrcDisposeLLJIT.
  • macOS was unaffected because Mach-O on arm64 is position independent by construction, which is why this went unnoticed.

Every :obj request now goes through JITTargetMachine, whose JITDefault code model resolves to large on x86-64 and whose Windows triple is *-elf. Assembly output (what most native tests inspect) is unchanged.

The existing Native.load users all pass :patch or :table and were already on this path; the first :bake + load tests arrive with #926 (device-library providers and the softfloat native test, which has vector constants), so this needs to land before or with those.

The native test helper only used JITTargetMachine for :patch and :table
jobs; :bake objects went through the stock target machine (small code
model, static relocations). Their 32-bit references to constant pools
cannot reach the addresses ORC loads code at, so JITLink rejects the object
("out of range of Pointer32Signed fixup") or, on older LLVM without the
range check, the worker segfaults. On Windows the stock machine also emits
COFF where the ORC JIT is configured for ELF, yielding garbage results and
a crash in LLVMOrcDisposeLLJIT. Only macOS, where Mach-O is inherently
position independent, was unaffected.

Every :obj request now goes through JITTargetMachine, whose JITDefault code
model is large on x86-64 and whose Windows triple is *-elf. Assembly output
is unchanged.
@maleadt
maleadt merged commit a698a02 into main Sep 9, 2026
31 of 33 checks passed
@maleadt
maleadt deleted the tb/jit-objects branch September 9, 2026 14:08
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.76%. Comparing base (c531942) to head (305e667).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #929   +/-   ##
=======================================
  Coverage   85.76%   85.76%           
=======================================
  Files          29       29           
  Lines        5597     5597           
=======================================
  Hits         4800     4800           
  Misses        797      797           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant