Skip to content

Commit 2642c7b

Browse files
humendaatopia
authored andcommitted
l4 linker: export_symbols should do nothing, not cause a compiler bug
FIXME adapted for new rustc
1 parent 5537cfd commit 2642c7b

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,10 +1297,10 @@ pub struct L4Bender<'a> {
12971297
}
12981298

12991299
impl<'a> Linker for L4Bender<'a> {
1300-
fn link_dylib(&mut self, lib: &str) {
1301-
self.link_staticlib(lib); // do not support dynamic linking for now
1300+
fn link_dylib(&mut self, _lib: Symbol) {
1301+
panic!("dylibs not supported yet")
13021302
}
1303-
fn link_staticlib(&mut self, lib: &str) {
1303+
fn link_staticlib(&mut self, lib: Symbol) {
13041304
self.hint_static();
13051305
self.cmd.arg(format!("-PC{}", lib));
13061306
}
@@ -1325,9 +1325,11 @@ impl<'a> Linker for L4Bender<'a> {
13251325
fn build_static_executable(&mut self) { self.cmd.arg("-static"); }
13261326
fn args(&mut self, args: &[String]) { self.cmd.args(args); }
13271327

1328-
fn link_rust_dylib(&mut self, lib: &str, _path: &Path) { self.link_dylib(lib); }
1328+
fn link_rust_dylib(&mut self, _: Symbol, _: &Path) {
1329+
panic!("Rust dylibs not supported");
1330+
}
13291331

1330-
fn link_framework(&mut self, _: &str) {
1332+
fn link_framework(&mut self, _: Symbol) {
13311333
bug!("Frameworks not supported on L4Re.");
13321334
}
13331335

@@ -1337,10 +1339,9 @@ impl<'a> Linker for L4Bender<'a> {
13371339
// don't otherwise explicitly reference them. This can occur for
13381340
// libraries which are just providing bindings, libraries with generic
13391341
// functions, etc.
1340-
fn link_whole_staticlib(&mut self, lib: &str, _: &[PathBuf]) {
1342+
fn link_whole_staticlib(&mut self, lib: Symbol, _: &[PathBuf]) {
13411343
self.hint_static();
1342-
self.cmd.arg("--whole-archive");
1343-
self.cmd.arg("-l").arg(lib);
1344+
self.cmd.arg("--whole-archive").arg(format!("-l{}", lib));
13441345
self.cmd.arg("--no-whole-archive");
13451346
}
13461347

@@ -1385,7 +1386,8 @@ impl<'a> Linker for L4Bender<'a> {
13851386
}
13861387

13871388
fn export_symbols(&mut self, _: &Path, _: CrateType) {
1388-
bug!("Not implemented");
1389+
// ToDo, not implemented, copy from GCC
1390+
return;
13891391
}
13901392

13911393
fn subsystem(&mut self, subsystem: &str) {
@@ -1404,6 +1406,9 @@ impl<'a> Linker for L4Bender<'a> {
14041406
fn linker_plugin_lto(&mut self) {
14051407
// do nothing
14061408
}
1409+
fn control_flow_guard(&mut self) {
1410+
self.sess.warn("Windows Control Flow Guard is not supported by this linker.");
1411+
}
14071412
}
14081413

14091414
impl<'a> L4Bender<'a> {

library/std/src/sys/unix/process/process_unix.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ use libc::RTP_ID as pid_t;
1414

1515
#[cfg(not(target_os = "vxworks"))]
1616
use libc::{c_int, gid_t, pid_t, uid_t};
17+
#[cfg(not(target_os = "l4re"))]
18+
use libc::{gid_t, uid_t};
19+
use libc::{c_int, pid_t};
1720

1821
////////////////////////////////////////////////////////////////////////////////
1922
// Command

0 commit comments

Comments
 (0)