Skip to content

Commit 320b9be

Browse files
humendaatopia
authored andcommitted
Update L4Bender due to updated Linker trait
1 parent 2642c7b commit 320b9be

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use super::command::Command;
33
use super::symbol_export;
44
use rustc_span::symbol::sym;
55

6-
use rustc_data_structures::fx::FxHashMap;
76
use std::env;
87
use std::ffi::{OsStr, OsString};
98
use std::fs::{self, File};
@@ -1323,7 +1322,9 @@ impl<'a> Linker for L4Bender<'a> {
13231322
fn partial_relro(&mut self) { self.cmd.arg("-z,relro"); }
13241323
fn no_relro(&mut self) { self.cmd.arg("-z,norelro"); }
13251324
fn build_static_executable(&mut self) { self.cmd.arg("-static"); }
1326-
fn args(&mut self, args: &[String]) { self.cmd.args(args); }
1325+
fn cmd(&mut self) -> &mut Command {
1326+
&mut self.cmd
1327+
}
13271328

13281329
fn link_rust_dylib(&mut self, _: Symbol, _: &Path) {
13291330
panic!("Rust dylibs not supported");
@@ -1362,19 +1363,15 @@ impl<'a> Linker for L4Bender<'a> {
13621363

13631364
fn pgo_gen(&mut self) { }
13641365

1365-
fn debuginfo(&mut self) {
1366-
match self.sess.opts.debuginfo {
1367-
DebugInfo::None => {
1368-
// If we are building without debuginfo enabled and we were called with
1369-
// `-Zstrip-debuginfo-if-disabled=yes`, tell the linker to strip any debuginfo
1370-
// found when linking to get rid of symbols from libstd.
1371-
match self.sess.opts.debugging_opts.strip_debuginfo_if_disabled {
1372-
Some(true) => { self.cmd.arg("-S"); },
1373-
_ => {},
1374-
}
1375-
},
1376-
_ => {},
1377-
};
1366+
fn debuginfo(&mut self, strip: Strip) {
1367+
match strip {
1368+
Strip::None => {}
1369+
Strip::Debuginfo => {
1370+
self.cmd().arg("--strip-debug"); }
1371+
Strip::Symbols => {
1372+
self.cmd().arg("--strip-all");
1373+
}
1374+
}
13781375
}
13791376

13801377
fn no_default_libraries(&mut self) {
@@ -1394,11 +1391,8 @@ impl<'a> Linker for L4Bender<'a> {
13941391
self.cmd.arg(&format!("--subsystem,{}", subsystem));
13951392
}
13961393

1397-
fn finalize(&mut self) -> Command {
1394+
fn finalize(&mut self) {
13981395
self.hint_static(); // Reset to default before returning the composed command line.
1399-
let mut cmd = Command::new("");
1400-
::std::mem::swap(&mut cmd, &mut self.cmd);
1401-
cmd
14021396
}
14031397

14041398
fn group_start(&mut self) { self.cmd.arg("--start-group"); }
@@ -1409,6 +1403,8 @@ impl<'a> Linker for L4Bender<'a> {
14091403
fn control_flow_guard(&mut self) {
14101404
self.sess.warn("Windows Control Flow Guard is not supported by this linker.");
14111405
}
1406+
1407+
fn no_crt_objects(&mut self) { }
14121408
}
14131409

14141410
impl<'a> L4Bender<'a> {

library/std/src/sys/unix/l4re.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub mod net {
5959
}
6060

6161
pub fn is_read_vectored(&self) -> bool {
62-
unimpl!();
62+
false
6363
}
6464

6565
pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
@@ -83,7 +83,7 @@ pub mod net {
8383
}
8484

8585
pub fn is_write_vectored(&self) -> bool {
86-
unimpl!();
86+
false
8787
}
8888

8989
pub fn set_timeout(&self, _: Option<Duration>, _: libc::c_int) -> io::Result<()> {
@@ -183,7 +183,7 @@ pub mod net {
183183
}
184184

185185
pub fn is_read_vectored(&self) -> bool {
186-
unimpl!();
186+
false
187187
}
188188

189189
pub fn write(&self, _: &[u8]) -> io::Result<usize> {
@@ -195,7 +195,7 @@ pub mod net {
195195
}
196196

197197
pub fn is_write_vectored(&self) -> bool {
198-
unimpl!();
198+
false
199199
}
200200

201201
pub fn peer_addr(&self) -> io::Result<SocketAddr> {

0 commit comments

Comments
 (0)