teymour-aldridge opened issue #4564:
Thanks for filing an issue! Please fill out the TODOs below.
.clif
Test Casefunction u0:0() -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = u0:1 sig0 fn1 = u0:2 sig1 block0: v0 = iconst.i64 13 v1 = call fn1(v0) v2 = call fn0(v1) v3 = iconst.i64 0 return v3 } function u0:1(i64) -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = colocated u0:2 sig0 fn1 = colocated u0:2 sig1 block0(v0: i64): v1 = iconst.i64 0 v2 = icmp eq v0, v1 brz v2, block2 jump block1 block1: v3 = iconst.i64 0 return v3 block2: v4 = iconst.i64 1 v5 = icmp.i64 eq v0, v4 brz v5, block4 jump block3 block3: v6 = iconst.i64 1 return v6 block4: v7 = iconst.i64 1 v8 = isub.i64 v0, v7 v9 = call fn0(v8) v10 = iconst.i64 2 v11 = isub.i64 v0, v10 v12 = call fn1(v11) v13 = iadd v9, v12 return v13 }
Steps to Reproduce
- Run on an Apple M1 chip
Expected Results
- The program should compile
Actual Results
The program paniced:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation addend Relocation { offset: 104, size: 26, kind: Relative, encoding: AArch64Call, symbol: SymbolId(3), addend: -4 }")', <some path>/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-object-0.86.1/src/backend.rs:500:22
Versions and Environment
Cranelift version or commit:
0.86.1
Operating system: MacOS
Architecture: M1
Extra Info
This works for me on aarch64-unknown-gnu (see https://cirrus-ci.com/task/6079482023903232 - it runs a lot of additional things, but near the bottom of the "test" task it compiles the Fibonacci function fine), but not aarch64-apple-darwin
teymour-aldridge labeled issue #4564:
Thanks for filing an issue! Please fill out the TODOs below.
.clif
Test Casefunction u0:0() -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = u0:1 sig0 fn1 = u0:2 sig1 block0: v0 = iconst.i64 13 v1 = call fn1(v0) v2 = call fn0(v1) v3 = iconst.i64 0 return v3 } function u0:1(i64) -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = colocated u0:2 sig0 fn1 = colocated u0:2 sig1 block0(v0: i64): v1 = iconst.i64 0 v2 = icmp eq v0, v1 brz v2, block2 jump block1 block1: v3 = iconst.i64 0 return v3 block2: v4 = iconst.i64 1 v5 = icmp.i64 eq v0, v4 brz v5, block4 jump block3 block3: v6 = iconst.i64 1 return v6 block4: v7 = iconst.i64 1 v8 = isub.i64 v0, v7 v9 = call fn0(v8) v10 = iconst.i64 2 v11 = isub.i64 v0, v10 v12 = call fn1(v11) v13 = iadd v9, v12 return v13 }
Steps to Reproduce
- Run on an Apple M1 chip
Expected Results
- The program should compile
Actual Results
The program paniced:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation addend Relocation { offset: 104, size: 26, kind: Relative, encoding: AArch64Call, symbol: SymbolId(3), addend: -4 }")', <some path>/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-object-0.86.1/src/backend.rs:500:22
Versions and Environment
Cranelift version or commit:
0.86.1
Operating system: MacOS
Architecture: M1
Extra Info
This works for me on aarch64-unknown-gnu (see https://cirrus-ci.com/task/6079482023903232 - it runs a lot of additional things, but near the bottom of the "test" task it compiles the Fibonacci function fine), but not aarch64-apple-darwin
teymour-aldridge labeled issue #4564:
Thanks for filing an issue! Please fill out the TODOs below.
.clif
Test Casefunction u0:0() -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = u0:1 sig0 fn1 = u0:2 sig1 block0: v0 = iconst.i64 13 v1 = call fn1(v0) v2 = call fn0(v1) v3 = iconst.i64 0 return v3 } function u0:1(i64) -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = colocated u0:2 sig0 fn1 = colocated u0:2 sig1 block0(v0: i64): v1 = iconst.i64 0 v2 = icmp eq v0, v1 brz v2, block2 jump block1 block1: v3 = iconst.i64 0 return v3 block2: v4 = iconst.i64 1 v5 = icmp.i64 eq v0, v4 brz v5, block4 jump block3 block3: v6 = iconst.i64 1 return v6 block4: v7 = iconst.i64 1 v8 = isub.i64 v0, v7 v9 = call fn0(v8) v10 = iconst.i64 2 v11 = isub.i64 v0, v10 v12 = call fn1(v11) v13 = iadd v9, v12 return v13 }
Steps to Reproduce
- Run on an Apple M1 chip
Expected Results
- The program should compile
Actual Results
The program paniced:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation addend Relocation { offset: 104, size: 26, kind: Relative, encoding: AArch64Call, symbol: SymbolId(3), addend: -4 }")', <some path>/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-object-0.86.1/src/backend.rs:500:22
Versions and Environment
Cranelift version or commit:
0.86.1
Operating system: MacOS
Architecture: M1
Extra Info
This works for me on aarch64-unknown-gnu (see https://cirrus-ci.com/task/6079482023903232 - it runs a lot of additional things, but near the bottom of the "test" task it compiles the Fibonacci function fine), but not aarch64-apple-darwin
teymour-aldridge edited issue #4564:
Thanks for filing an issue! Please fill out the TODOs below.
.clif
Test Casefunction u0:0() -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = u0:1 sig0 fn1 = u0:2 sig1 block0: v0 = iconst.i64 13 v1 = call fn1(v0) v2 = call fn0(v1) v3 = iconst.i64 0 return v3 } function u0:1(i64) -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = colocated u0:2 sig0 fn1 = colocated u0:2 sig1 block0(v0: i64): v1 = iconst.i64 0 v2 = icmp eq v0, v1 brz v2, block2 jump block1 block1: v3 = iconst.i64 0 return v3 block2: v4 = iconst.i64 1 v5 = icmp.i64 eq v0, v4 brz v5, block4 jump block3 block3: v6 = iconst.i64 1 return v6 block4: v7 = iconst.i64 1 v8 = isub.i64 v0, v7 v9 = call fn0(v8) v10 = iconst.i64 2 v11 = isub.i64 v0, v10 v12 = call fn1(v11) v13 = iadd v9, v12 return v13 }
Steps to Reproduce
- Run on an Apple M1 chip
Expected Results
- The program should compile
Actual Results
The program paniced:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation addend Relocation { offset: 104, size: 26, kind: Relative, encoding: AArch64Call, symbol: SymbolId(3), addend: -4 }")', <some path>/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-object-0.86.1/src/backend.rs:500:22
Versions and Environment
Cranelift version or commit:
0.86.1
Operating system: MacOS
Architecture: M1
Extra Info
This works for me on aarch64-unknown-gnu (see https://cirrus-ci.com/task/6079482023903232 - it runs a lot of additional things, but near the bottom of the "test" task it compiles the Fibonacci function fine), but not aarch64-apple-darwin. It also works on x86_64-apple-darwin.
cfallin commented on issue #4564:
Thanks for the report. Did this CLIF come from Wasmtime or some other frontend? (I ask because we try to support Wasmtime's use of Cranelift on aarch64-apple-darwin but the use of Cranelift with other frontends is much less well-tested. That doesn't mean we don't want to support it, I'm just trying to judge the severity.) It sounds like we need to implement another relocation case here. If you're willing to dig into it further, I'd be happy to review a PR.
teymour-aldridge commented on issue #4564:
Did this CLIF come from Wasmtime or some other frontend?
It came from a different frontend (a small compiler I'm writing). The problem seems to be with
cranelift-object
, because I can run the same program without error by usingcranelift-jit
(which I have adopted as a stopgap solution).If you're willing to dig into it further, I'd be happy to review a PR.
I'd be happy to, but I'm not sure what a relocation is :)
teymour-aldridge edited issue #4564:
Thanks for filing an issue! Please fill out the TODOs below.
.clif
Test Casefunction u0:0() -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = u0:1 sig0 fn1 = u0:2 sig1 block0: v0 = iconst.i64 13 v1 = call fn1(v0) v2 = call fn0(v1) v3 = iconst.i64 0 return v3 } function u0:1(i64) -> i64 apple_aarch64 { sig0 = (i64) -> i64 apple_aarch64 sig1 = (i64) -> i64 apple_aarch64 fn0 = colocated u0:2 sig0 fn1 = colocated u0:2 sig1 block0(v0: i64): v1 = iconst.i64 0 v2 = icmp eq v0, v1 brz v2, block2 jump block1 block1: v3 = iconst.i64 0 return v3 block2: v4 = iconst.i64 1 v5 = icmp.i64 eq v0, v4 brz v5, block4 jump block3 block3: v6 = iconst.i64 1 return v6 block4: v7 = iconst.i64 1 v8 = isub.i64 v0, v7 v9 = call fn0(v8) v10 = iconst.i64 2 v11 = isub.i64 v0, v10 v12 = call fn1(v11) v13 = iadd v9, v12 return v13 }
Steps to Reproduce
- Run on an Apple M1 chip
Expected Results
- The program should compile
Actual Results
The program paniced:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("unimplemented relocation addend Relocation { offset: 104, size: 26, kind: Relative, encoding: AArch64Call, symbol: SymbolId(3), addend: -4 }")', <some path>/.cargo/registry/src/github.com-1ecc6299db9ec823/cranelift-object-0.86.1/src/backend.rs:500:22
Versions and Environment
Cranelift version or commit:
0.86.1
Operating system: MacOS
Architecture: M1
Extra Info
This works for me on aarch64-unknown-gnu (see https://cirrus-ci.com/task/6079482023903232 - it runs a lot of additional things, but near the bottom of the "test" task it compiles the Fibonacci function fine), but not aarch64-apple-darwin. It also works on x86_64-apple-darwin.
teymour-aldridge commented on issue #4564:
On 02/08/2022 01:27, Chris Fallin wrote:
Did this CLIF come from Wasmtime or some other frontend?
It came from a different frontend (a small compiler I'm writing). The
problem seems to be withcranelift-object
, because I can run the same
program without error by usingcranelift-jit
.If you're willing to dig into it further, I'd be happy to review a PR.
I'd be happy to, but I'm not sure what a relocation is :)
teymour-aldridge deleted a comment on issue #4564:
On 02/08/2022 01:27, Chris Fallin wrote:
Did this CLIF come from Wasmtime or some other frontend?
It came from a different frontend (a small compiler I'm writing). The
problem seems to be withcranelift-object
, because I can run the same
program without error by usingcranelift-jit
.If you're willing to dig into it further, I'd be happy to review a PR.
I'd be happy to, but I'm not sure what a relocation is :)
afonso360 commented on issue #4564:
I think this might already be fixed upstream in https://github.com/gimli-rs/object/pull/465, so it might be a case of just updating the object crate whenever they do their next release.
afonso360 commented on issue #4564:
:wave: Hey,
Would you be able to test this code using PR #5434? It includes the updated version of object, and I suspect it might fix your issue.
Last updated: Dec 23 2024 at 12:05 UTC