Skip to content

Invalid target files cause an ICE #86017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Lslightly opened this issue Jun 5, 2021 · 5 comments · Fixed by #86062
Closed

Invalid target files cause an ICE #86017

Lslightly opened this issue Jun 5, 2021 · 5 comments · Fixed by #86062
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Lslightly
Copy link

Lslightly commented Jun 5, 2021

I'm new to Rust and I try to compile a project with a build.sh.(I'm also new to that project and that project is not well organized.)

when I use Makefile to make, the process of making executes build.sh and it reports it's a bug, so I'm here.

build.sh

xargo build --target x86_64-sel4

I'm fresh here so if there is some information I don't provide, please tell me and I will try my best to provide it.

Thank you!

Code

here I couldn't provide the example code since I don't really know the minimal set of code to be compiled

the source code of the repo is in sel4-rust

rustc should be in the nightly mode

rust code is in the rust/sel4-rust/

make in sel4 directory will execute build.sh in rust/sel4-rust/ directory

<code>

Meta

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

Error output

error: internal compiler error: compiler/rustc_codegen_llvm/src/context.rs:151:13: data-layout for builtin `x86_64-unknown-unknown-gnu` target, `e-m:e-i64:64-f80:128-n8:16:32:64-S128`, differs from LLVM default, `e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128`

error: aborting due to previous error

error: could not compile `core`
Backtrace

thread 'rustc' panicked at 'Box<Any>', /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panic.rs:59:5
stack backtrace:
   0: std::panicking::begin_panic
   1: std::panic::panic_any
   2: rustc_errors::HandlerInner::bug
   3: rustc_errors::Handler::bug
   4: rustc_middle::ty::context::tls::with_opt
   5: rustc_middle::util::bug::opt_span_bug_fmt
   6: rustc_middle::util::bug::bug_fmt
   7: rustc_codegen_llvm::context::create_module
   8: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
   9: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task
  10: rustc_codegen_llvm::base::compile_codegen_unit
  11: rustc_codegen_ssa::base::codegen_crate
  12: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  13: rustc_interface::passes::QueryContext::enter
  14: rustc_interface::queries::Queries::ongoing_codegen
  15: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  16: rustc_span::with_source_map
  17: rustc_interface::interface::create_compiler_and_run
  18: scoped_tls::ScopedKey<T>::set

To learn more, run the command again with --verbose.
error: `"cargo" "build" "--release" "--manifest-path" "/tmp/xargo.jtC88UquoXTV/Cargo.toml" "--target" "x86_64-sel4" "-p" "core"` failed with exit code: Some(101)
   0: error_chain::backtrace::imp::InternalBacktrace::new
   1: <error_chain::State as core::default::Default>::default
   2: <std::process::Command as xargo::extensions::CommandExt>::run
   3: xargo::sysroot::build
   4: xargo::sysroot::update
   5: xargo::main_inner
   6: std::sys_common::backtrace::__rust_begin_short_backtrace
   7: std::rt::lang_start::{{closure}}
   8: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/core/src/ops/function.rs:259:13
      std::panicking::try::do_call
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:379:40
      std::panicking::try
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panicking.rs:343:19
      std::panic::catch_unwind
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/panic.rs:431:14
      std::rt::lang_start_internal
             at /rustc/42816d61ead7e46d462df997958ccfd514f8c21c/library/std/src/rt.rs:51:25
   9: main
  10: __libc_start_main
  11: _start

make: *** [Makefile:200: RUST] Error 1

@Lslightly Lslightly added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 5, 2021
@inquisitivecrystal
Copy link
Contributor

@Lslightly

Thank you for filing an issue! When I click that linked you posted, I get an error. Is it set that other people can view it?

@Lslightly
Copy link
Author

Lslightly commented Jun 6, 2021

@Lslightly

Thank you for filing an issue! When I click that linked you posted, I get an error. Is it set that other people can view it?

Sorry, I have fixed the typo. Now the link should be right.(next time I will be more careful to check my issue)

@nagisa
Copy link
Member

nagisa commented Jun 6, 2021

The root of the issue is in the target definition file that the repository contains, however there are three other bugs that can be fixed in rustc:

  1. We should not ICE when invalid external targets are being used;
  2. We should report the actual target name/file in the error message, not the LLVM target name;
  3. JSON target files are allowed to set the is_builtin property.

@nagisa nagisa changed the title Seems a Bug? Invalid target files cause an ICE Jun 6, 2021
@nagisa
Copy link
Member

nagisa commented Jun 6, 2021

The minimal target file to reproduce:

{
  "arch": "x86_64",
  "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
  "is-builtin": true,
  "llvm-target": "x86_64-unknown-unknown-gnu",
  "target-pointer-width": "64"
}

with

echo '#![feature(no_core)] #![no_core]' | rustc --target the_file.json -

@bl-ue
Copy link

bl-ue commented Jun 6, 2021

(@bookofportals is a 404 🤔)

fanninpm added a commit to fanninpm/glacier that referenced this issue Jun 18, 2021
JohnTitor pushed a commit to fanninpm/glacier that referenced this issue Jun 21, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 21, 2021
@bors bors closed this as completed in 153df0f Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants