Skip to content

CFI compilation of libcore on arm32 fails to encode array length #122851

Closed
@maurer

Description

@maurer

This is with rustc-1.76 built as a dev branch, so it's possible this is already fixed in nightly.

Buildbot Version: androidbuild_buildbot_20240306.00_RC00
Machine: prod-2004-4925
trusty/vendor/google/aosp/scripts/build.py --build-root `pwd`/out --archive /buildbot/dist_dirs/aosp-trusty-master-linux-generic_arm32/P71943188 --buildid P71943188 --jobs 80 generic-arm32
make/module.mk:351: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcompiler_builtins.rlib'
make/module.mk:351: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcompiler_builtins.rlib'
make/module.mk:351: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib'
make/module.mk:351: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib'
make/library.mk:301: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/sdk/sysroot//usr/include/c++/v1/./__cxxabi_config.h'
make/library.mk:301: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/sdk/sysroot//usr/include/c++/v1/./__cxxabi_config.h'
make/library.mk:248: trusty/user/app/storage is a userspace library module but has deprecated MODULE_DEPS: trusty/user/app/storage/test/block_host_test trusty/user/app/storage/test/storage_host_test .
Failed to run rustfmt: cannot find binary path (non-fatal, continuing)
thread 'rustc' panicked at compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:530:41:
failed to convert length to u64
stack backtrace:
   0:     0x7f1b777a54ca - <std[ec5684ef7c50a2a5]::sys_common::backtrace::_print::DisplayBacktrace as core[8c2debda200eca11]::fmt::Display>::fmt
   1:     0x7f1b777fff6f - core[8c2debda200eca11]::fmt::write
   2:     0x7f1b77798d93 - <std[ec5684ef7c50a2a5]::sys::unix::stdio::Stderr as std[ec5684ef7c50a2a5]::io::Write>::write_fmt
   3:     0x7f1b777a52a0 - std[ec5684ef7c50a2a5]::sys_common::backtrace::print
   4:     0x7f1b777a816a - std[ec5684ef7c50a2a5]::panicking::default_hook::{closure#1}
   5:     0x7f1b777a7e8d - std[ec5684ef7c50a2a5]::panicking::default_hook
   6:     0x7f1b79609f84 - std[ec5684ef7c50a2a5]::panicking::update_hook::<alloc[8d7d43742b28871a]::boxed::Box<rustc_driver_impl[b2f5e955e22cd905]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f1b777a8913 - std[ec5684ef7c50a2a5]::panicking::rust_panic_with_hook
   8:     0x7f1b777a8619 - std[ec5684ef7c50a2a5]::panicking::begin_panic_handler::{closure#0}
   9:     0x7f1b777a59f6 - std[ec5684ef7c50a2a5]::sys_common::backtrace::__rust_end_short_backtrace::<std[ec5684ef7c50a2a5]::panicking::begin_panic_handler::{closure#0}, !>
  10:     0x7f1b777a8374 - rust_begin_unwind
  11:     0x7f1b777fc4a9 - core[8c2debda200eca11]::panicking::panic_fmt
  12:     0x7f1b7aeee276 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::encode_ty
  13:     0x7f1b7aef3c45 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
  14:     0x7f1b7aef1471 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
  15:     0x7f1b7932b825 - <rustc_codegen_llvm[94e810ad66e13edc]::context::CodegenCx>::declare_fn
  16:     0x7f1b79344416 - <rustc_codegen_llvm[94e810ad66e13edc]::context::CodegenCx as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::declare::PreDefineMethods>::predefine_fn
  17:     0x7f1b792f666a - rustc_codegen_llvm[94e810ad66e13edc]::base::compile_codegen_unit::module_codegen
  18:     0x7f1b7934b3b4 - <rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  19:     0x7f1b79240533 - rustc_codegen_ssa[50a0ac7ae2ebdae7]::base::codegen_crate::<rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend>
  20:     0x7f1b79356921 - <rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::backend::CodegenBackend>::codegen_crate
  21:     0x7f1b79eb4018 - rustc_interface[c0948e53bd2b6698]::passes::start_codegen
  22:     0x7f1b79ebe351 - <rustc_interface[c0948e53bd2b6698]::queries::Queries>::codegen_and_build_linker
  23:     0x7f1b79607a02 - rustc_interface[c0948e53bd2b6698]::interface::run_compiler::<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}
  24:     0x7f1b795fc4b1 - std[ec5684ef7c50a2a5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_with_globals<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_pool_with_globals<rustc_interface[c0948e53bd2b6698]::interface::run_compiler<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>
  25:     0x7f1b7960f11e - <<std[ec5684ef7c50a2a5]::thread::Builder>::spawn_unchecked_<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_with_globals<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_pool_with_globals<rustc_interface[c0948e53bd2b6698]::interface::run_compiler<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#1} as core[8c2debda200eca11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7f1b777b2c59 - <std[ec5684ef7c50a2a5]::sys::unix::thread::Thread>::new::thread_start
  27:     0x7f1b6fcf0184 - start_thread
                               at /build/eglibc-xkFqqE/eglibc-2.19/nptl/pthread_create.c:312
  28:     0x7f1b7742803d - __clone
                               at /build/eglibc-xkFqqE/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111

error: 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: please attach the file at `/buildbot/src/android/master/rustc-ice-2024-03-21T03_47_08-213.txt` to your bug report

note: compiler flags: -C codegen-units=1 -C debuginfo=2 -C opt-level=3 -C relocation-model=pic -C overflow-checks=on -C symbol-mangling-version=v0 -C panic=abort -Z link-native-libraries=no -Z panic_abort_tests -C linker-plugin-lto -Z split-lto-unit -Z force-unstable-if-unmarked -Z sanitizer=cfi -Z sanitizer-cfi-normalize-integers --crate-type rlib --crate-type rlib

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

query stack during panic:
end of query stack
make/rust-toplevel.mk:32: /buildbot/src/android/master/out/build-generic-arm32/kernellib/crate-dependency-ordering: No such file or directory
make[2]: *** [make/module.mk:353: /buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib] Error 101
make[1]: *** [/buildbot/src/android/master/external/lk/engine.mk:29: make-make] Error 2
make: *** [/buildbot/src/android/master/external/lk/makefile:34: _top] Error 2

I locally computed the command it was running, and it's:
/usr/local/google/home/mmaurer/android/trusty/prebuilts/rust/linux-x86/1.76.0/bin/rustc -C codegen-units=1 -C debuginfo=2 -C opt-level=3 -C relocation-model=pic -C overflow-checks=on -C symbol-mangling-version=v0 -C panic=abort -Z link-native-libraries=no -Z panic_abort_tests --deny warnings -L dependency=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/host_lib -L dependency=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib -C linker-plugin-lto -Zsplit-lto-unit --target=/usr/local/google/home/mmaurer/android/trusty/external/lk/arch/arm/armv7-unknown-trusty-kernel.json -Z force-unstable-if-unmarked -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers --crate-name=core -C metadata=core --edition 2021 --emit link --crate-type=rlib --crate-type=rlib /usr/local/google/home/mmaurer/android/trusty/prebuilts/rust/linux-x86/1.76.0/bin/../src/stdlibs/library/core/src/lib.rs --emit "dep-info=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib/libcore.rlib.d" -o /usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib/libcore.rlib

Since the input file is core/src/lib.rs, this shouldn't technically require more information than what I've gathered, but I'll try to minimize this soon if nobody else immediately knows the answer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sanitizersArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions