diff options
| author | usamoi <usamoi@outlook.com> | 2025-07-14 16:41:42 +0800 |
|---|---|---|
| committer | usamoi <usamoi@outlook.com> | 2025-07-17 14:54:52 +0800 |
| commit | 5bb6b9db300870f436e8a45ffbe11efa41e44cad (patch) | |
| tree | 03f4be76f63cfcdb15ef4185d30911dacd6c15bc | |
| parent | f58accb8f370a0a9e89548f2d890bd09ede3e613 (diff) | |
| download | rust-5bb6b9db300870f436e8a45ffbe11efa41e44cad.tar.gz rust-5bb6b9db300870f436e8a45ffbe11efa41e44cad.zip | |
remove no_gc_sections
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/linker.rs | 33 | ||||
| -rw-r--r-- | tests/run-make/export-executable-symbols/rmake.rs | 1 | ||||
| -rw-r--r-- | tests/ui/linking/export-executable-symbols.rs | 1 |
4 files changed, 2 insertions, 35 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index ae148287a60..5ce301c0eb9 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2543,8 +2543,6 @@ fn add_order_independent_options( let keep_metadata = crate_type == CrateType::Dylib || sess.opts.cg.profile_generate.enabled(); cmd.gc_sections(keep_metadata); - } else { - cmd.no_gc_sections(); } cmd.set_output_kind(link_output_kind, crate_type, out_filename); diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index e0a3ad55be0..050797354b4 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -326,7 +326,6 @@ pub(crate) trait Linker { link_or_cc_args(self, &[path]); } fn gc_sections(&mut self, keep_metadata: bool); - fn no_gc_sections(&mut self); fn full_relro(&mut self); fn partial_relro(&mut self); fn no_relro(&mut self); @@ -688,12 +687,6 @@ impl<'a> Linker for GccLinker<'a> { } } - fn no_gc_sections(&mut self) { - if self.is_gnu || self.sess.target.is_like_wasm { - self.link_arg("--no-gc-sections"); - } - } - fn optimize(&mut self) { if !self.is_gnu && !self.sess.target.is_like_wasm { return; @@ -1010,10 +1003,6 @@ impl<'a> Linker for MsvcLinker<'a> { } } - fn no_gc_sections(&mut self) { - self.link_arg("/OPT:NOREF,NOICF"); - } - fn full_relro(&mut self) { // noop } @@ -1243,10 +1232,6 @@ impl<'a> Linker for EmLinker<'a> { // noop } - fn no_gc_sections(&mut self) { - // noop - } - fn optimize(&mut self) { // Emscripten performs own optimizations self.cc_arg(match self.sess.opts.optimize { @@ -1418,10 +1403,6 @@ impl<'a> Linker for WasmLd<'a> { self.link_arg("--gc-sections"); } - fn no_gc_sections(&mut self) { - self.link_arg("--no-gc-sections"); - } - fn optimize(&mut self) { // The -O flag is, as of late 2023, only used for merging of strings and debuginfo, and // only differentiates -O0 and -O1. It does not apply to LTO. @@ -1567,10 +1548,6 @@ impl<'a> Linker for L4Bender<'a> { } } - fn no_gc_sections(&mut self) { - self.link_arg("--no-gc-sections"); - } - fn optimize(&mut self) { // GNU-style linkers support optimization with -O. GNU ld doesn't // need a numeric argument, but other linkers do. @@ -1734,10 +1711,6 @@ impl<'a> Linker for AixLinker<'a> { self.link_arg("-bgc"); } - fn no_gc_sections(&mut self) { - self.link_arg("-bnogc"); - } - fn optimize(&mut self) {} fn pgo_gen(&mut self) { @@ -1982,8 +1955,6 @@ impl<'a> Linker for PtxLinker<'a> { fn gc_sections(&mut self, _keep_metadata: bool) {} - fn no_gc_sections(&mut self) {} - fn pgo_gen(&mut self) {} fn no_crt_objects(&mut self) {} @@ -2057,8 +2028,6 @@ impl<'a> Linker for LlbcLinker<'a> { fn gc_sections(&mut self, _keep_metadata: bool) {} - fn no_gc_sections(&mut self) {} - fn pgo_gen(&mut self) {} fn no_crt_objects(&mut self) {} @@ -2139,8 +2108,6 @@ impl<'a> Linker for BpfLinker<'a> { fn gc_sections(&mut self, _keep_metadata: bool) {} - fn no_gc_sections(&mut self) {} - fn pgo_gen(&mut self) {} fn no_crt_objects(&mut self) {} diff --git a/tests/run-make/export-executable-symbols/rmake.rs b/tests/run-make/export-executable-symbols/rmake.rs index c602a43f957..aa130b0855b 100644 --- a/tests/run-make/export-executable-symbols/rmake.rs +++ b/tests/run-make/export-executable-symbols/rmake.rs @@ -5,6 +5,7 @@ // See https://github.com/rust-lang/rust/pull/85673 //@ ignore-wasm +//@ ignore-cross-compile use run_make_support::object::Object; use run_make_support::{bin_name, is_darwin, object, rustc}; diff --git a/tests/ui/linking/export-executable-symbols.rs b/tests/ui/linking/export-executable-symbols.rs index edaf312f192..2bff58ca38a 100644 --- a/tests/ui/linking/export-executable-symbols.rs +++ b/tests/ui/linking/export-executable-symbols.rs @@ -1,6 +1,7 @@ //@ run-pass //@ compile-flags: -Ctarget-feature=-crt-static -Zexport-executable-symbols //@ ignore-wasm +//@ ignore-cross-compile //@ edition: 2024 // Regression test for <https://github.com/rust-lang/rust/issues/101610>. |
