Skip to content

[ICE]: should be implemented in ISLE: inst = v0 = tls_value.i64 gv0, type = Some(types::I64) #1343

Not planned
@pan93412

Description

@pan93412

Build on commit 598f090.

rustc version

rustc 1.68.0-nightly (4c83bd03a 2023-01-19)
binary: rustc
commit-hash: 4c83bd03a9d94af35c97a6b8b595d40e291af84a
commit-date: 2023-01-19
host: aarch64-apple-darwin
release: 1.68.0-nightly
LLVM version: 15.0.6

Current error output

$ ./test.sh

[BUILD] y.rs
[BUILD] rustc_codegen_cranelift
   Compiling cfg-if v1.0.0
   Compiling libc v0.2.138
   Compiling version_check v0.9.4
   Compiling autocfg v1.1.0
   Compiling once_cell v1.16.0
   Compiling cranelift-isle v0.92.0
   Compiling log v0.4.17
   Compiling cranelift-codegen-shared v0.92.0
   Compiling cranelift-codegen-meta v0.92.0
   Compiling byteorder v1.4.3
   Compiling target-lexicon v0.12.5
   Compiling ahash v0.7.6
   Compiling indexmap v1.9.2
   Compiling fxhash v0.2.1
   Compiling smallvec v1.10.0
   Compiling slice-group-by v0.3.0
   Compiling stable_deref_trait v1.2.0
   Compiling fallible-iterator v0.2.0
   Compiling cranelift-entity v0.92.0
   Compiling arrayvec v0.7.2
   Compiling cranelift-bforest v0.92.0
   Compiling regalloc2 v0.5.1
   Compiling getrandom v0.2.8
   Compiling bumpalo v3.11.1
   Compiling anyhow v1.0.66
   Compiling crc32fast v1.3.2
   Compiling memchr v2.5.0
   Compiling mach v0.3.2
   Compiling hashbrown v0.12.3
   Compiling bitflags v1.3.2
   Compiling wasmtime-jit-icache-coherence v5.0.0
   Compiling libloading v0.7.4
   Compiling region v2.2.0
   Compiling cranelift-codegen v0.92.0
   Compiling gimli v0.26.2
   Compiling object v0.29.0
   Compiling cranelift-module v0.92.0
   Compiling cranelift-native v0.92.0
   Compiling cranelift-frontend v0.92.0
   Compiling cranelift-jit v0.92.0
   Compiling cranelift-object v0.92.0
   Compiling rustc_codegen_cranelift v0.1.0 (/Users/pan93412/.toolchains/rustc_codegen_cranelift)
    Finished release [optimized] target(s) in 44.73s
[BUILD] sysroot None
[BUILD] mini_core
thread '<unnamed>' panicked at 'should be implemented in ISLE: inst = `v0 = tls_value.i64 gv0`, type = `Some(types::I64)`', /Users/pan93412/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.92.0/src/machinst/lower.rs:753:21
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: cranelift_codegen::machinst::lower::Lower<I>::lower
   3: cranelift_codegen::machinst::compile::compile
   4: <cranelift_codegen::isa::aarch64::AArch64Backend as cranelift_codegen::isa::TargetIsa>::compile_function
   5: cranelift_codegen::context::Context::compile_stencil
   6: cranelift_codegen::context::Context::compile
   7: cranelift_codegen::context::Context::compile_and_emit
   8: <cranelift_object::backend::ObjectModule as cranelift_module::module::Module>::define_function
   9: rustc_codegen_cranelift::base::compile_fn
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0-nightly (4c83bd03a 2023-01-19) running on aarch64-apple-darwin

note: compiler flags: -C link-arg=-undefined -C link-arg=dynamic_lookup -C debuginfo=2 -C panic=abort --crate-type lib,dylib -C panic=abort -Z panic-abort-tests -Z codegen-backend=/Users/pan93412/.toolchains/rustc_codegen_cranelift/./dist/lib/librustc_codegen_cranelift.dylib

query stack during panic:
end of query stack

Backtrace

$ RUST_BACKTRACE=full ./test.sh

[BUILD] y.rs
[BUILD] rustc_codegen_cranelift
    Finished release [optimized] target(s) in 0.09s
[BUILD] sysroot None
[BUILD] mini_core
thread '<unnamed>' panicked at 'should be implemented in ISLE: inst = `v0 = tls_value.i64 gv0`, type = `Some(types::I64)`', /Users/pan93412/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cranelift-codegen-0.92.0/src/machinst/lower.rs:753:21
stack backtrace:
   0:        0x102d75be4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h182b07f912ee834e
   1:        0x102dc72f8 - core::fmt::write::h4e6218f56f35b350
   2:        0x102d695e0 - std::io::Write::write_fmt::hf2f8c08bf0bb5fb8
   3:        0x102d759f8 - std::sys_common::backtrace::print::h146366cf19b75a76
   4:        0x102d7854c - std::panicking::default_hook::{{closure}}::h303e7bd38ae0f952
   5:        0x102d782a4 - std::panicking::default_hook::h5bb8fda2a687cc8d
   6:        0x10afb2568 - rustc_driver[22e6a040d85edbc4]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x102d78c44 - std::panicking::rust_panic_with_hook::h8b2ecde24c9fa079
   8:        0x102d78a3c - std::panicking::begin_panic_handler::{{closure}}::h78fbd6109cabcec3
   9:        0x102d7604c - std::sys_common::backtrace::__rust_end_short_backtrace::h049ca249d0288246
  10:        0x102d78798 - _rust_begin_unwind
  11:        0x102df2f48 - core::panicking::panic_fmt::he0821a984c845948
  12:        0x10419a998 - cranelift_codegen::machinst::lower::Lower<I>::lower::h9c98056ed2d57cd4
  13:        0x103faf884 - cranelift_codegen::machinst::compile::compile::hc84f12164aef64f7
  14:        0x1040283c8 - <cranelift_codegen::isa::aarch64::AArch64Backend as cranelift_codegen::isa::TargetIsa>::compile_function::hf735129fbba7a9b0
  15:        0x10417b3a8 - cranelift_codegen::context::Context::compile_stencil::h93edacadd99941c8
  16:        0x10417b914 - cranelift_codegen::context::Context::compile::hb950a5665b5a524d
  17:        0x10417b26c - cranelift_codegen::context::Context::compile_and_emit::h554ab3a7d571efb7
  18:        0x103ed14c4 - <cranelift_object::backend::ObjectModule as cranelift_module::module::Module>::define_function::h1c81a8bc9b5e095e
  19:        0x103e91a54 - rustc_codegen_cranelift::base::compile_fn::h047a1aa9be6c0d16
  20:        0x103dfb270 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc9307dee147394a1
  21:        0x103e5690c - core::ops::function::FnOnce::call_once{{vtable.shim}}::hd3a06bece3aafcfe
  22:        0x102d815fc - std::sys::unix::thread::Thread::new::thread_start::hb48462719b7459f7
  23:        0x191ddd06c - __pthread_deallocate

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.68.0-nightly (4c83bd03a 2023-01-19) running on aarch64-apple-darwin

note: compiler flags: -C link-arg=-undefined -C link-arg=dynamic_lookup -C debuginfo=2 -C panic=abort --crate-type lib,dylib -C panic=abort -Z panic-abort-tests -Z codegen-backend=/Users/pan93412/.toolchains/rustc_codegen_cranelift/./dist/lib/librustc_codegen_cranelift.dylib

query stack during panic:
end of query stack

Reproduce steps

  1. mkdir ~/.toolchain && cd ~/.toolchain
  2. git clone https://github.com/bjorn3/rustc_codegen_cranelift (may need to switch to commit 598f0909568a51de8a2d1148f55a644fd8dffad0)
  3. cd rustc_codegen_cranelift/
  4. ./y.rs prepare
  5. ./test.sh

Additional Information

Seems like it should be reported to upstream: https://github.com/bytecodealliance/wasmtime/tree/main/cranelift. Panic happened here:

https://github.com/bytecodealliance/wasmtime/blob/69cd0a6b1a78c9c793b549256d76c879b48cb3db/cranelift/codegen/src/machinst/lower.rs#L753

Activity

afonso360

afonso360 commented on Jan 21, 2023

@afonso360
Contributor

This should be fixed by bytecodealliance/wasmtime#5434

bjorn3

bjorn3 commented on Jan 21, 2023

@bjorn3
Member

https://github.com/bjorn3/rustc_codegen_cranelift/issues/1248 is the tracking issue for AArch64 support under macOS. TLS is not the only thing unimplemented. bytecodealliance/wasmtime#5544 is another one which will cause a linker warning and dynamic linker crash until fixed. In addition the hack I use to implement variadic arguments without Cranelift support works on basically every platform except AArch64 macOS as Apple decided to change their ABI compared to Arm's Aapcs such that it doesn't work.

I will close this in favor of https://github.com/bjorn3/rustc_codegen_cranelift/issues/1248.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @afonso360@bjorn3@pan93412

        Issue actions

          [ICE]: should be implemented in ISLE: inst = `v0 = tls_value.i64 gv0`, type = `Some(types::I64)` · Issue #1343 · rust-lang/rustc_codegen_cranelift