Skip to content

Commit 79b43df

Browse files
committed
Auto merge of rust-lang#138208 - jhpratt:rollup-hlqyu51, r=jhpratt
Rollup of 5 pull requests Successful merges: - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package) - rust-lang#137528 (Windows: Fix error in `fs::rename` on Windows 1607) - rust-lang#137685 (self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux) - rust-lang#137757 (On long spans, trim the middle of them to make them fit in the terminal width) - rust-lang#138189 (Mention `env` and `option_env` macros in `std::env::var` docs) r? `@ghost` `@rustbot` modify labels: rollup
2 parents cdd8af2 + 6576d35 commit 79b43df

File tree

109 files changed

+1047
-866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1047
-866
lines changed

compiler/rustc_codegen_cranelift/patches/0029-stdlib-Disable-f16-and-f128-in-compiler-builtins.patch

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ index 7165c3e48af..968552ad435 100644
1212
--- a/library/alloc/Cargo.toml
1313
+++ b/library/alloc/Cargo.toml
1414
@@ -11,7 +11,7 @@ test = { path = "../test" }
15-
edition = "2021"
15+
bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
1919
-compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std'] }
2020
+compiler_builtins = { version = "=0.1.151", features = ['rustc-dep-of-std', 'no-f16-f128'] }
2121

22-
[dev-dependencies]
23-
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
22+
[features]
23+
compiler-builtins-mem = ['compiler_builtins/mem']
2424
--
2525
2.34.1
2626

compiler/rustc_codegen_ssa/src/back/link.rs

+29
Original file line numberDiff line numberDiff line change
@@ -3382,6 +3382,35 @@ fn add_lld_args(
33823382
// this, `wasm-component-ld`, which is overridden if this option is passed.
33833383
if !sess.target.is_like_wasm {
33843384
cmd.cc_arg("-fuse-ld=lld");
3385+
3386+
// On ELF platforms like at least x64 linux, GNU ld and LLD have opposite defaults on some
3387+
// section garbage-collection features. For example, the somewhat popular `linkme` crate and
3388+
// its dependents rely in practice on this difference: when using lld, they need `-z
3389+
// nostart-stop-gc` to prevent encapsulation symbols and sections from being
3390+
// garbage-collected.
3391+
//
3392+
// More information about all this can be found in:
3393+
// - https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
3394+
// - https://lld.llvm.org/ELF/start-stop-gc
3395+
//
3396+
// So when using lld, we restore, for now, the traditional behavior to help migration, but
3397+
// will remove it in the future.
3398+
// Since this only disables an optimization, it shouldn't create issues, but is in theory
3399+
// slightly suboptimal. However, it:
3400+
// - doesn't have any visible impact on our benchmarks
3401+
// - reduces the need to disable lld for the crates that depend on this
3402+
//
3403+
// Note that lld can detect some cases where this difference is relied on, and emits a
3404+
// dedicated error to add this link arg. We could make use of this error to emit an FCW. As
3405+
// of writing this, we don't do it, because lld is already enabled by default on nightly
3406+
// without this mitigation: no working project would see the FCW, so we do this to help
3407+
// stabilization.
3408+
//
3409+
// FIXME: emit an FCW if linking fails due its absence, and then remove this link-arg in the
3410+
// future.
3411+
if sess.target.llvm_target == "x86_64-unknown-linux-gnu" {
3412+
cmd.link_arg("-znostart-stop-gc");
3413+
}
33853414
}
33863415

33873416
if !flavor.is_gnu() {

0 commit comments

Comments
 (0)