Skip to content

Commit 5bb6b9d

Browse files
committed
remove no_gc_sections
1 parent f58accb commit 5bb6b9d

File tree

4 files changed

+2
-35
lines changed

4 files changed

+2
-35
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,8 +2543,6 @@ fn add_order_independent_options(
25432543
let keep_metadata =
25442544
crate_type == CrateType::Dylib || sess.opts.cg.profile_generate.enabled();
25452545
cmd.gc_sections(keep_metadata);
2546-
} else {
2547-
cmd.no_gc_sections();
25482546
}
25492547

25502548
cmd.set_output_kind(link_output_kind, crate_type, out_filename);

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ pub(crate) trait Linker {
326326
link_or_cc_args(self, &[path]);
327327
}
328328
fn gc_sections(&mut self, keep_metadata: bool);
329-
fn no_gc_sections(&mut self);
330329
fn full_relro(&mut self);
331330
fn partial_relro(&mut self);
332331
fn no_relro(&mut self);
@@ -688,12 +687,6 @@ impl<'a> Linker for GccLinker<'a> {
688687
}
689688
}
690689

691-
fn no_gc_sections(&mut self) {
692-
if self.is_gnu || self.sess.target.is_like_wasm {
693-
self.link_arg("--no-gc-sections");
694-
}
695-
}
696-
697690
fn optimize(&mut self) {
698691
if !self.is_gnu && !self.sess.target.is_like_wasm {
699692
return;
@@ -1010,10 +1003,6 @@ impl<'a> Linker for MsvcLinker<'a> {
10101003
}
10111004
}
10121005

1013-
fn no_gc_sections(&mut self) {
1014-
self.link_arg("/OPT:NOREF,NOICF");
1015-
}
1016-
10171006
fn full_relro(&mut self) {
10181007
// noop
10191008
}
@@ -1243,10 +1232,6 @@ impl<'a> Linker for EmLinker<'a> {
12431232
// noop
12441233
}
12451234

1246-
fn no_gc_sections(&mut self) {
1247-
// noop
1248-
}
1249-
12501235
fn optimize(&mut self) {
12511236
// Emscripten performs own optimizations
12521237
self.cc_arg(match self.sess.opts.optimize {
@@ -1418,10 +1403,6 @@ impl<'a> Linker for WasmLd<'a> {
14181403
self.link_arg("--gc-sections");
14191404
}
14201405

1421-
fn no_gc_sections(&mut self) {
1422-
self.link_arg("--no-gc-sections");
1423-
}
1424-
14251406
fn optimize(&mut self) {
14261407
// The -O flag is, as of late 2023, only used for merging of strings and debuginfo, and
14271408
// only differentiates -O0 and -O1. It does not apply to LTO.
@@ -1567,10 +1548,6 @@ impl<'a> Linker for L4Bender<'a> {
15671548
}
15681549
}
15691550

1570-
fn no_gc_sections(&mut self) {
1571-
self.link_arg("--no-gc-sections");
1572-
}
1573-
15741551
fn optimize(&mut self) {
15751552
// GNU-style linkers support optimization with -O. GNU ld doesn't
15761553
// need a numeric argument, but other linkers do.
@@ -1734,10 +1711,6 @@ impl<'a> Linker for AixLinker<'a> {
17341711
self.link_arg("-bgc");
17351712
}
17361713

1737-
fn no_gc_sections(&mut self) {
1738-
self.link_arg("-bnogc");
1739-
}
1740-
17411714
fn optimize(&mut self) {}
17421715

17431716
fn pgo_gen(&mut self) {
@@ -1982,8 +1955,6 @@ impl<'a> Linker for PtxLinker<'a> {
19821955

19831956
fn gc_sections(&mut self, _keep_metadata: bool) {}
19841957

1985-
fn no_gc_sections(&mut self) {}
1986-
19871958
fn pgo_gen(&mut self) {}
19881959

19891960
fn no_crt_objects(&mut self) {}
@@ -2057,8 +2028,6 @@ impl<'a> Linker for LlbcLinker<'a> {
20572028

20582029
fn gc_sections(&mut self, _keep_metadata: bool) {}
20592030

2060-
fn no_gc_sections(&mut self) {}
2061-
20622031
fn pgo_gen(&mut self) {}
20632032

20642033
fn no_crt_objects(&mut self) {}
@@ -2139,8 +2108,6 @@ impl<'a> Linker for BpfLinker<'a> {
21392108

21402109
fn gc_sections(&mut self, _keep_metadata: bool) {}
21412110

2142-
fn no_gc_sections(&mut self) {}
2143-
21442111
fn pgo_gen(&mut self) {}
21452112

21462113
fn no_crt_objects(&mut self) {}

tests/run-make/export-executable-symbols/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// See https://github.com/rust-lang/rust/pull/85673
66

77
//@ ignore-wasm
8+
//@ ignore-cross-compile
89

910
use run_make_support::object::Object;
1011
use run_make_support::{bin_name, is_darwin, object, rustc};

tests/ui/linking/export-executable-symbols.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ run-pass
22
//@ compile-flags: -Ctarget-feature=-crt-static -Zexport-executable-symbols
33
//@ ignore-wasm
4+
//@ ignore-cross-compile
45
//@ edition: 2024
56

67
// Regression test for <https://github.com/rust-lang/rust/issues/101610>.

0 commit comments

Comments
 (0)