Skip to content

Compilation fails on compiler_builtin v0.1.18 #2

Closed
@0ndorio

Description

@0ndorio

It seems like the latest update of compiler_builtin to v0.1.18 got us in a situation where it is no longer possible to build for the xtensa-esp32-none-elf target.

The issue appears due to the line assert!(stack_required) of classify_arg_ty() in src/librustc_target/abi/call/xtensa.rs.

the stack trace

thread 'rustc' panicked at 'assertion failed: stack_required', src/librustc_target/abi/call/xtensa.rs:78:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: rustc_target::abi::call::xtensa::classify_arg_ty
   8: rustc_target::abi::call::xtensa::compute_abi_info
   9: <rustc_target::abi::call::FnType<'tcx, &'tcx rustc::ty::TyS<'tcx>> as rustc_codegen_llvm::abi::FnTypeExt<'tcx>>::adjust_for_abi
  10: <rustc_target::abi::call::FnType<'tcx, &'tcx rustc::ty::TyS<'tcx>> as rustc_codegen_llvm::abi::FnTypeExt<'tcx>>::new
  11: rustc_codegen_llvm::declare::<impl rustc_codegen_ssa::traits::declare::DeclareMethods<'tcx> for rustc_codegen_llvm::context::CodegenCx<'ll, 'tcx>>::declare_fn
  12: rustc_codegen_llvm::mono_item::<impl rustc_codegen_ssa::traits::declare::PreDefineMethods<'tcx> for rustc_codegen_llvm::context::CodegenCx<'ll, 'tcx>>::predefine_fn
  13: rustc_codegen_ssa::mono_item::MonoItemExt::predefine
  14: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
  15: rustc::dep_graph::graph::DepGraph::with_task
  16: rustc_codegen_llvm::base::compile_codegen_unit
  17: rustc_codegen_ssa::base::codegen_crate
  18: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  19: rustc::util::common::time
  20: rustc_driver::driver::phase_4_codegen
  21: <std::thread::local::LocalKey<T>>::with
  22: rustc::ty::context::TyCtxt::create_and_enter
  23: rustc_driver::driver::compile_input
  24: <scoped_tls::ScopedKey<T>>::set
  25: rustc_driver::run_compiler
  26: <scoped_tls::ScopedKey<T>>::set
  27: syntax::with_globals
  28: __rust_maybe_catch_panic
  29: <F as alloc::boxed::FnBox<A>>::call_box
  30: std::sys_common::thread::start_thread
  31: std::sys::unix::thread::Thread::new::thread_start
  32: start_thread
  33: __clone
query stack during panic:
end of query stack

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.34.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z force-unstable-if-unmarked -C opt-level=3 -C codegen-units=1 -C target-cpu=esp32 -C save-temps -C link-arg=-nostdlib -C link-arg=-ucall_user_start_cpu0 -C link-arg=-u__cxa_guard_dummy -C link-arg=-u__cxx_fatal_exception -C link-arg=-uld_include_panic_highint_hdl -C link-arg=-uesp_app_desc -C link-arg=-Wl,--gc-sections -C link-arg=-Wl,-static -C link-arg=-Wl,--start-group -C link-arg=-Lbuild/app_update -C link-arg=-lapp_update -C link-arg=-Lbuild/driver -C link-arg=-ldriver -C link-arg=-Lbuild/esp-tls -C link-arg=-lesp-tls -C link-arg=-Lbuild/esp32 -C link-arg=-lesp32 -C link-arg=esp-idf/components/esp32/libhal.a -C link-arg=-Lesp-idf/components/esp32/lib -C link-arg=-lcore -C link-arg=-Lesp-idf/components/esp32/ld -C link-arg=-Tesp32_out.ld -C link-arg=-Tbuild/esp32/esp32.project.ld -C link-arg=-Tesp32.rom.ld -C link-arg=-Tesp32.peripherals.ld -C link-arg=-Tesp32.rom.libgcc.ld -C link-arg=-Tesp32.rom.spiram_incompatible_fns.ld -C link-arg=-Lbuild/esp_ringbuf -C link-arg=-lesp_ringbuf -C link-arg=-Lbuild/freertos -C link-arg=-lfreertos -C link-arg=-Wl,--undefined=uxTopUsedPriority -C link-arg=-Lbuild/heap -C link-arg=-lheap -C link-arg=-Lbuild/log -C link-arg=-llog -C link-arg=esp-idf/components/newlib/lib/libc.a -C link-arg=esp-idf/components/newlib/lib/libm.a -C link-arg=-Lbuild/newlib -C link-arg=-lnewlib -C link-arg=-Lbuild/pthread -C link-arg=-lpthread -C link-arg=-Lbuild/soc -C link-arg=-lsoc -C link-arg=-Lbuild/spi_flash -C link-arg=-lspi_flash -C link-arg=-Lbuild/vfs -C link-arg=-lvfs -C link-arg=-Lbuild/xtensa-debug-module -C link-arg=-lxtensa-debug-module -C link-arg=-lgcc -C link-arg=-lstdc++ -C link-arg=-lgcov -C link-arg=-Wl,--end-group -C link-arg=-Wl,-EL --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `compiler_builtins`.

Some debug output I could inject:

[src/librustc_target/abi/call/xtensa.rs:70] arg.layout.details = LayoutDetails {
    variants: Single {
        index: 0
    },
    fields: Arbitrary {
        offsets: [
            Size {
                raw: 0
            },
            Size {
                raw: 16
            }
        ],
        memory_index: [
            0,
            1
        ]
    },
    abi: ScalarPair(
        Scalar {
            value: Int(
                I128,
                true
            ),
            valid_range: 0..=340282366920938463463374607431768211455
        },
        Scalar {
            value: Int(
                I8,
                false
            ),
            valid_range: 0..=1
        }
    ),
    align: AbiAndPrefAlign {
        abi: Align {
            pow2: 3
        },
        pref: Align {
            pow2: 3
        }
    },
    size: Size {
        raw: 24
    }
}
[src/librustc_target/abi/call/xtensa.rs:71] xlen = 32
[src/librustc_target/abi/call/xtensa.rs:72] remaining_gpr = 0
[src/librustc_target/abi/call/xtensa.rs:74] arg_size.bits() = 192
[src/librustc_target/abi/call/xtensa.rs:75] MAX_ARG_IN_REGS_SIZE = 128

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

    Issue actions