rust/compiler
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
..
rustc
rustc_apfloat
rustc_arena Add some comments. 2021-11-19 07:52:59 +11:00
rustc_ast expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00
rustc_ast_lowering Rollup merge of #91273 - Badel2:ice-index-str, r=estebank 2021-12-03 06:24:14 +01:00
rustc_ast_passes Rollup merge of #91208 - estebank:eq-constraint, r=cjgillot 2021-11-27 11:46:44 +01:00
rustc_ast_pretty expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00
rustc_attr re-format with new rustfmt 2021-11-30 13:08:41 -05:00
rustc_borrowck Rollup merge of #91321 - matthewjasper:constaint-placeholders, r=jackh726 2021-12-02 22:16:09 +01:00
rustc_builtin_macros Rollup merge of #91313 - petrochenkov:cratexp, r=Aaron1011 2021-12-01 20:57:43 +01:00
rustc_codegen_cranelift fix sparc64 ABI for aggregates with floating point members 2021-12-01 10:03:45 +01:00
rustc_codegen_gcc Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa 2021-12-02 02:59:44 +00:00
rustc_codegen_llvm code-cov: generate dead functions with private/default linkage 2021-12-03 12:00:12 -05:00
rustc_codegen_ssa Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry 2021-12-01 10:50:20 +01:00
rustc_const_eval Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr 2021-12-02 21:58:48 +00:00
rustc_data_structures Rollup merge of #88906 - Kixunil:box-maybe-uninit-write, r=dtolnay 2021-12-03 06:24:11 +01:00
rustc_driver add rustc option for using LLVM stack smash protection 2021-11-22 20:06:22 +01:00
rustc_error_codes Clarify and tidy up explanation of E0038 2021-11-30 09:25:17 -08:00
rustc_errors Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini 2021-12-02 15:52:03 +01:00
rustc_expand Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini 2021-12-02 15:52:03 +01:00
rustc_feature Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelid 2021-11-24 22:56:37 +01:00
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #91354 - fee1-dead:const_env, r=spastorino 2021-12-02 11:48:58 +00:00
rustc_hir_pretty
rustc_incremental
rustc_index Auto merge of #90491 - Mark-Simulacrum:push-pred-faster, r=matthewjasper 2021-11-24 15:51:46 +00:00
rustc_infer Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
rustc_interface expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00
rustc_lexer udpate comment to be more accurate 2021-11-23 20:37:23 +00:00
rustc_lint Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini 2021-12-02 15:52:03 +01:00
rustc_lint_defs
rustc_llvm Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry 2021-12-01 10:50:20 +01:00
rustc_macros Rename TypeFolderFallible to FallibleTypeFolder 2021-12-02 16:14:18 +00:00
rustc_metadata Improve suggestion for extern crate self error message 2021-12-01 21:59:54 +00:00
rustc_middle Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726 2021-12-03 06:24:17 +01:00
rustc_mir_build Fix stack overflow in usefulness.rs 2021-11-23 23:07:11 +01:00
rustc_mir_dataflow Auto merge of #90788 - ecstatic-morse:issue-90752, r=wesleywiser 2021-11-23 17:44:33 +00:00
rustc_mir_transform Rollup merge of #91410 - ecstatic-morse:const-precise-live-drops-take-2, r=oli-obk 2021-12-02 22:16:13 +01:00
rustc_monomorphize
rustc_parse Rollup merge of #91435 - FabianWolff:issue-91421-if-then, r=lcnr 2021-12-02 22:16:13 +01:00
rustc_parse_format
rustc_passes Apply cfg-bootstrap switch 2021-11-30 10:51:42 -05:00
rustc_plugin_impl
rustc_privacy Take a LocalDefId in expect_*item. 2021-11-28 21:09:45 +01:00
rustc_query_impl
rustc_query_system Manually outline error on incremental_verify_ich 2021-11-22 21:32:20 -05:00
rustc_resolve Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini 2021-12-02 15:52:03 +01:00
rustc_save_analysis
rustc_serialize Avoid generating empty closures for fieldless enums 2021-11-22 21:22:35 -05:00
rustc_session Accumulate all values of -C remark option 2021-11-29 09:12:01 +01:00
rustc_span Improve the comments in Symbol::interner. 2021-12-03 07:12:31 +11:00
rustc_symbol_mangling
rustc_target Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa 2021-12-02 02:59:44 +00:00
rustc_trait_selection Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr 2021-12-02 21:58:48 +00:00
rustc_traits Reduce boilerplate around infallible folders 2021-12-02 16:14:16 +00:00
rustc_ty_utils Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726 2021-12-03 06:24:17 +01:00
rustc_type_ir
rustc_typeck Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr 2021-12-02 21:58:48 +00:00