1
Fork 0

Merge commit '918acafef6' into sync_cg_clif-2025-01-05

This commit is contained in:
bjorn3 2025-01-05 15:44:46 +00:00
commit a94e2d513b
16 changed files with 119 additions and 248 deletions

View file

@ -333,10 +333,9 @@ fn make_module(sess: &Session, name: String) -> UnwindModule<ObjectModule> {
let mut builder =
ObjectBuilder::new(isa, name + ".o", cranelift_module::default_libcall_names()).unwrap();
// Unlike cg_llvm, cg_clif defaults to disabling -Zfunction-sections. For cg_llvm binary size
// is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections
// can easily double the amount of time necessary to perform linking.
builder.per_function_section(sess.opts.unstable_opts.function_sections.unwrap_or(false));
builder.per_function_section(
sess.opts.unstable_opts.function_sections.unwrap_or(sess.target.function_sections),
);
UnwindModule::new(ObjectModule::new(builder), true)
}

View file

@ -287,7 +287,7 @@ fn dep_symbol_lookup_fn(
let mut dylib_paths = Vec::new();
let data = &crate_info.dependency_formats[&rustc_session::config::CrateType::Executable].1;
let data = &crate_info.dependency_formats[&rustc_session::config::CrateType::Executable];
// `used_crates` is in reverse postorder in terms of dependencies. Reverse the order here to
// get a postorder which ensures that all dependencies of a dylib are loaded before the dylib
// itself. This helps the dynamic linker to find dylibs not in the regular dynamic library

View file

@ -136,7 +136,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
fx.bcx.ins().jump(destination_block, &[]);
}
None => {
fx.bcx.ins().trap(TrapCode::user(0 /* unreachable */).unwrap());
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
}
}
}

View file

@ -1136,7 +1136,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
_ => {
fx.tcx.dcx().span_err(span, format!("Unknown SIMD intrinsic {}", intrinsic));
// Prevent verifier error
fx.bcx.ins().trap(TrapCode::user(0 /* unreachable */).unwrap());
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
return;
}
}

View file

@ -27,6 +27,8 @@ extern crate rustc_metadata;
extern crate rustc_session;
extern crate rustc_span;
extern crate rustc_target;
#[macro_use]
extern crate tracing;
// This prevents duplicating functions and statics that are already part of the host rustc process.
#[allow(unused_extern_crates)]
@ -208,6 +210,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
need_metadata_module: bool,
) -> Box<dyn Any> {
tcx.dcx().abort_if_errors();
info!("codegen crate {}", tcx.crate_name(LOCAL_CRATE));
let config = self.config.clone().unwrap_or_else(|| {
BackendConfig::from_opts(&tcx.sess.opts.cg.llvm_args)
.unwrap_or_else(|err| tcx.sess.dcx().fatal(err))