rust/compiler/rustc_codegen_llvm/src
bors d137783642 Auto merge of #102900 - abrachet:master, r=bjorn3
Don't internalize __llvm_profile_counter_bias

Currently, LLVM profiling runtime counter relocation cannot be used by rust during LTO because symbols are being internalized before all symbol information is known.

This mode makes LLVM emit a __llvm_profile_counter_bias symbol which is referenced by the profiling initialization, which itself is pulled in by the rust driver here [1].

It is enabled with -Cllvm-args=-runtime-counter-relocation for platforms which are opt-in to this mode like Linux. On these platforms there will be no link error, rather just surprising behavior for a user which request runtime counter relocation. The profiling runtime will not see that symbol go on as if it were never there. On Fuchsia, the profiling runtime must have this symbol which will cause a hard link error.

As an aside, I don't have enough context as to why rust's LTO model is how it is. AFAICT, the internalize pass is only safe to run at link time when all symbol information is actually known, this being an example as to why. I think special casing this symbol as a known one that LLVM can emit which should not have it's visbility de-escalated should be fine given how seldom this pattern of defining an undefined symbol to get initilization code pulled in is. From a quick grep, __llvm_profile_runtime is the only symbol that rustc does this for.

[1] 0265a3e93b/compiler/rustc_codegen_ssa/src/back/linker.rs (L598)
2022-12-11 14:42:45 +00:00
..
back Don't internalize __llvm_profile_counter_bias 2022-12-07 16:32:59 +00:00
coverageinfo Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
debuginfo Move closure/generator type info methods to TyCtxt 2022-12-07 17:00:33 +00:00
llvm Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3 2022-12-10 09:24:43 +01:00
abi.rs Improve generating Custom entry function 2022-11-11 01:04:39 +05:30
allocator.rs Add LLVM KCFI support to the Rust compiler 2022-12-08 17:24:39 -08:00
asm.rs Rollup merge of #103977 - TimNN:memory-effects, r=nikic 2022-11-05 00:02:05 +01:00
attributes.rs Mark naked functions as never inline in codegen_fn_attrs 2022-12-03 01:04:42 +01:00
base.rs Remove several unused methods from MiscMethods 2022-10-01 16:45:07 +00:00
builder.rs Add LLVM KCFI support to the Rust compiler 2022-12-08 17:24:39 -08:00
callee.rs Workaround for private global symbol issue 2022-11-18 11:38:31 -08:00
common.rs Introduce a fallible variant of LLVMConstIntGetZExtValue 2022-09-09 15:54:14 +02:00
consts.rs Move linkage type check to HIR analysis and fix semantics issues. 2022-12-05 15:05:43 -08:00
context.rs Add LLVM KCFI support to the Rust compiler 2022-12-08 17:24:39 -08:00
declare.rs Add LLVM KCFI support to the Rust compiler 2022-12-08 17:24:39 -08:00
errors.rs Move linkage type check to HIR analysis and fix semantics issues. 2022-12-05 15:05:43 -08:00
intrinsic.rs Add Mutability::{is_mut,is_not} 2022-11-23 20:26:31 +00:00
lib.rs Port diagnostics created by Handler 2022-11-09 14:56:21 +01:00
llvm_util.rs Rollup merge of #105026 - oToToT:aarch64-v8a, r=davidtwco 2022-12-02 21:22:47 +01:00
mono_item.rs Fix diag() and formatting 2022-11-09 14:56:20 +01:00
type_.rs Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3 2022-12-10 09:24:43 +01:00
type_of.rs add is_sized method on Abi and Layout, and use it 2022-11-13 12:23:53 +01:00
va_arg.rs Introduce Bx::switch_to_block 2022-02-24 12:18:21 +01:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00