bytecodealliance / bytecodealliance/wasmtime

Cranelift: error "unimplemented relocation addend Relocation" on MacOS on aarch64

Open
#4,564 4 comments 0 reactions 0 assignees View on GitHub
bug cranelift
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

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

- 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 }")', /.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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.