rust/compiler/rustc_codegen_ssa/src/back
bors b14fd2359f Auto merge of #113695 - bjorn3:fix_rlib_cdylib_metadata_handling, r=pnkfelix,petrochenkov
Verify that all crate sources are in sync

This ensures that rustc will not attempt to link against a cdylib as if it is a rust dylib when an rlib for the same crate is available. Previously rustc didn't actually check if any further formats of a crate which has been loaded are of the same version and if they are actually valid. This caused a cdylib to be interpreted as rust dylib as soon as the corresponding rlib was loaded. As cdylibs don't export any rust symbols, linking would fail if rustc decides to link against the cdylib rather than the rlib.

Two crates depended on the previous behavior by separately compiling a test crate as both rlib and dylib. These have been changed to capture their original spirit to the best of my ability while still working when rustc verifies that all crates are in sync. It is unlikely that build systems depend on the current behavior and in any case we are taking a lot of measures to ensure that any change to either the source or the compilation options (including crate type) results in rustc rejecting it as incompatible. We merely didn't do this check here for now obsolete perf reasons.

Fixes https://github.com/rust-lang/rust/issues/10786
Fixes https://github.com/rust-lang/rust/issues/82151
Fixes https://github.com/rust-lang/rust/issues/82972
Closes https://github.com/bevy-cheatbook/bevy-cheatbook/issues/114
2023-07-20 09:00:10 +00:00
..
rpath Remove LibSource 2021-07-05 10:49:07 +02:00
archive.rs Recognize AIX style archive kind 2023-04-19 11:10:47 +08:00
command.rs Reduce usage of Symbol in the linker code 2022-06-28 18:38:36 +00:00
link.rs Auto merge of #113626 - Urgau:dedup-native-static-libs, r=petrochenkov 2023-07-16 10:59:45 +00:00
linker.rs Don't assume that -Bdynamic is the default linker mode 2023-05-17 22:52:54 +02:00
lto.rs Merge new_metadata into codegen_allocator 2022-04-30 21:20:08 +02:00
metadata.rs Fix review comments 2023-07-19 14:53:26 +00:00
mod.rs Use the object crate for metadata reading 2021-05-07 18:48:58 +02:00
rpath.rs pass -Wl,-z,origin to set DF_ORIGIN when using rpath 2021-12-17 11:27:14 +00:00
symbol_export.rs Introduce MonoItemData. 2023-07-17 08:44:48 +10:00
write.rs On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00