Stream: git-wasmtime

Topic: wasmtime / issue #4564 Cranelift: error "unimplemented re...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 30 2022 at 11:28):

teymour-aldridge opened issue #4564:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

function 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

  1. Run on an Apple M1 chip

Expected Results

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

view this post on Zulip Wasmtime GitHub notifications bot (Jul 30 2022 at 11:28):

teymour-aldridge labeled issue #4564:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

function 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

  1. Run on an Apple M1 chip

Expected Results

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

view this post on Zulip Wasmtime GitHub notifications bot (Jul 30 2022 at 11:28):

teymour-aldridge labeled issue #4564:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

function 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

  1. Run on an Apple M1 chip

Expected Results

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

view this post on Zulip Wasmtime GitHub notifications bot (Jul 30 2022 at 11:28):

teymour-aldridge edited issue #4564:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

function 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

  1. Run on an Apple M1 chip

Expected Results

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 01 2022 at 17:27):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 02 2022 at 03:28):

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 withcranelift-object, because I can run the same program without error by using cranelift-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 :)

view this post on Zulip Wasmtime GitHub notifications bot (Aug 05 2022 at 02:51):

teymour-aldridge edited issue #4564:

Thanks for filing an issue! Please fill out the TODOs below.

.clif Test Case

function 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

  1. Run on an Apple M1 chip

Expected Results

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.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2022 at 08:39):

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 using cranelift-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 :)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2022 at 08:40):

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 using cranelift-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 :)

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2022 at 14:17):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Jan 08 2023 at 18:48):

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