Summary
Had a mesh rendering with the wrong rotation in my Bevy game. Traced it
down to glam::Quat::from_rotation_x(-FRAC_PI_2) returning a different
value under cranelift than under LLVM, but only when a cranelift crate is
calling into an LLVM-compiled glam.
Quat is #[repr(C, align(16))] over [f32; 4]. Under pure LLVM the call
returns (-sqrt(2)/2, 0, 0, sqrt(2)/2) like you'd expect. Under the mixed
build the value just comes back wrong. No panic, no link warning.
Configs I tried
Bevy 0.17, rustc nightly:
| workspace |
deps |
link |
target |
result |
| cranelift |
llvm |
dylib |
x86_64-pc-windows-gnu |
wrong |
| cranelift |
llvm |
static |
x86_64-pc-windows-gnu |
wrong |
| cranelift |
llvm |
static |
x86_64-pc-windows-msvc |
wrong |
| llvm |
llvm |
dylib |
x86_64-pc-windows-gnu |
correct |
| llvm |
llvm |
static |
x86_64-pc-windows-gnu |
correct |
| cranelift |
cranelift |
static |
x86_64-pc-windows-gnu |
correct |
Every failing row has a cranelift caller invoking an LLVM callee. Doesn't
matter whether it's static or DLL, gnu or msvc. A friend runs the same
cranelift-workspace + LLVM-deps + bevy dynamic_linking setup on
x86_64-unknown-linux-gnu with no issues, so this looks Win64-specific.
Couldn't test
Related
Can cut a smaller repo without Bevy if it'd help.
Summary
Had a mesh rendering with the wrong rotation in my Bevy game. Traced it
down to
glam::Quat::from_rotation_x(-FRAC_PI_2)returning a differentvalue under cranelift than under LLVM, but only when a cranelift crate is
calling into an LLVM-compiled glam.
Quatis#[repr(C, align(16))]over[f32; 4]. Under pure LLVM the callreturns
(-sqrt(2)/2, 0, 0, sqrt(2)/2)like you'd expect. Under the mixedbuild the value just comes back wrong. No panic, no link warning.
Configs I tried
Bevy 0.17, rustc nightly:
x86_64-pc-windows-gnux86_64-pc-windows-gnux86_64-pc-windows-msvcx86_64-pc-windows-gnux86_64-pc-windows-gnux86_64-pc-windows-gnuEvery failing row has a cranelift caller invoking an LLVM callee. Doesn't
matter whether it's static or DLL, gnu or msvc. A friend runs the same
cranelift-workspace + LLVM-deps + bevy
dynamic_linkingsetup onx86_64-unknown-linux-gnuwith no issues, so this looks Win64-specific.Couldn't test
in cg_clif.
Vec3,Transform, custom structs): haven't tested. Couldbe one cell of a wider mismatch or specific to 16-byte-aligned
[f32; 4].Related
abi-cafefailures): same family, but I haven't run abi-cafe tocheck whether this specific combo shows up there.
dynamic_linking): same config family,different symptom (crash vs wrong value). My matrix shows
dynamic_linkingisn't required for this one.Can cut a smaller repo without Bevy if it'd help.