rust/compiler/rustc_codegen_llvm/src
Wesley Wiser d5f6b9c8c2 code-cov: generate dead functions with private/default linkage
As discovered in #85461, the MSVC linker treats weak symbols slightly
differently than unix-y linkers do. This causes link.exe to fail with
LNK1227 "conflicting weak extern definition" where as other targets are
able to link successfully.

This changes the dead functions from being generated as weak/hidden to
private/default which, as the LLVM reference says:

> Global values with “private” linkage are only directly accessible by
objects in the current module. In particular, linking code into a module
with a private global value may cause the private to be renamed as
necessary to avoid collisions. Because the symbol is private to the
module, all references can be updated. This doesn’t show up in any
symbol table in the object file.

This fixes the conflicting weak symbols but doesn't address the reason
*why* we have conflicting symbols for these dead functions. The test
cases added in this commit contain a minimal repro of the fundamental
issue which is that the logic used to decide what dead code functions
should be codegen'd in the current CGU doesn't take into account that
functions can be duplicated across multiple CGUs (for instance, in the
case of `#[inline(always)]` functions).

Fixing that is likely to be a more complex change (see
https://github.com/rust-lang/rust/issues/85461#issuecomment-985005805).

Fixes #85461
2021-12-03 12:00:12 -05:00
..
back Emit LLVM optimization remarks when enabled with -Cremark 2021-11-16 08:19:20 +01:00
coverageinfo code-cov: generate dead functions with private/default linkage 2021-12-03 12:00:12 -05:00
debuginfo re-format with new rustfmt 2021-11-30 13:08:41 -05:00
llvm Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry 2021-12-01 10:50:20 +01:00
abi.rs Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa 2021-12-02 02:59:44 +00:00
allocator.rs Include debug info for the allocator shim 2021-08-31 15:24:20 -07:00
asm.rs Update more rustc/libtest things for wasm64 2021-11-10 08:35:42 -08:00
attributes.rs add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
base.rs Make hash_result an Option. 2021-10-20 18:29:18 +02:00
builder.rs Use more robust checks in rustc for wasm 2021-11-10 08:35:42 -08:00
callee.rs add platform support details file for armv7-unknown-linux-uclibc 2021-10-06 14:33:13 +00:00
common.rs Make abi::Abi Copy and remove a *lot* of refs 2021-09-09 10:41:19 +02:00
consts.rs Use more robust checks in rustc for wasm 2021-11-10 08:35:42 -08:00
context.rs Remove workaround for the forward progress handling in LLVM 2021-11-14 16:35:09 +01:00
declare.rs Remove the decl arg from FnAbi::llvm_type 2021-08-05 10:58:55 -07:00
intrinsic.rs Remove workaround for the forward progress handling in LLVM 2021-11-14 16:35:09 +01:00
lib.rs add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
llvm_util.rs Disable .debug_aranges for all wasm targets 2021-11-10 10:47:00 -08:00
mono_item.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
type_.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
type_of.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
va_arg.rs Fix clippy lints 2021-10-01 23:17:19 +02:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00