X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftools%2Fmiri%2Fsrc%2Fhelpers.rs;h=527d31d1f0ae8acc199671562b425742a8a0eb15;hb=333ee6c466972185973d5097f8b5fb0f9fb13fa5;hp=c11c6104c2843474c4a253216daedc471d66ebb0;hpb=c1f8a3ffb2b9b155b400a675727ebd470938805c;p=rust.git diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index c11c6104c28..527d31d1f0a 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -943,7 +943,16 @@ fn check_abi_and_shim_symbol_clash( link_name: Symbol, ) -> InterpResult<'tcx, ()> { self.check_abi(abi, exp_abi)?; - if let Some((body, _)) = self.eval_context_mut().lookup_exported_symbol(link_name)? { + if let Some((body, instance)) = self.eval_context_mut().lookup_exported_symbol(link_name)? { + // If compiler-builtins is providing the symbol, then don't treat it as a clash. + // We'll use our built-in implementation in `emulate_foreign_item_by_name` for increased + // performance. Note that this means we won't catch any undefined behavior in + // compiler-builtins when running other crates, but Miri can still be run on + // compiler-builtins itself (or any crate that uses it as a normal dependency) + if self.eval_context_ref().tcx.is_compiler_builtins(instance.def_id().krate) { + return Ok(()); + } + throw_machine_stop!(TerminationInfo::SymbolShimClashing { link_name, span: body.span.data(),