Only allow compiler_builtins to call LLVM intrinsics, not any link_name function #123347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another case of accidental reliance on
inline(never)
like I rooted out in #118770. Without this PR, attempting to build some large programs with-Zcross-crate-inline-threshold=yes
with a sysroot also compiled with that flag will result in linker errors like this:With
-Zcross-crate-inline-threshold=yes
we can inlinepanic_fmt
intocompiler_builtins
. Then we end up with a call to an upstream monomorphization, but one that has alink_name
set. But unlike LLVM's magic intrinsic names, this link name is going to make it to the linker, and then we have a problem.This logic looks scuffed, but also we're doing this in 4 other places. Don't know if that means it's good or bad.
rust/compiler/rustc_codegen_cranelift/src/abi/mod.rs
Line 386 in 1684a75
rust/compiler/rustc_ast_passes/src/feature_gate.rs
Line 306 in 1684a75
rust/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Line 609 in 1684a75
rust/compiler/rustc_codegen_gcc/src/declare.rs
Line 170 in 1684a75