Skip to content

Commit 9334175

Browse files
committed
remove linker arguments from L4Re target
These change from release to release and are impossible to get right, since they are generated by Make magic.
1 parent 87344aa commit 9334175

File tree

2 files changed

+17
-56
lines changed

2 files changed

+17
-56
lines changed

src/librustc_back/target/l4re_base.rs

+16-55
Original file line numberDiff line numberDiff line change
@@ -8,74 +8,35 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use PanicStrategy;
1211
use LinkerFlavor;
12+
use PanicStrategy;
1313
use target::{LinkArgs, TargetOptions};
1414
use std::default::Default;
15-
use std::env;
16-
use std::process::Command;
15+
//use std::process::Command;
1716

1817
// Use GCC to locate code for crt* libraries from the host, not from L4Re. Note
1918
// that a few files also come from L4Re, for these, the function shouldn't be
2019
// used. This uses GCC for the location of the file, but GCC is required for L4Re anyway.
21-
fn get_path_or(filename: &str) -> String {
22-
let child = Command::new("gcc")
23-
.arg(format!("-print-file-name={}", filename)).output()
24-
.expect("Failed to execute GCC");
25-
String::from_utf8(child.stdout)
26-
.expect("Couldn't read path from GCC").trim().into()
27-
}
20+
//fn get_path_or(filename: &str) -> String {
21+
// let child = Command::new("gcc")
22+
// .arg(format!("-print-file-name={}", filename)).output()
23+
// .expect("Failed to execute GCC");
24+
// String::from_utf8(child.stdout)
25+
// .expect("Couldn't read path from GCC").trim().into()
26+
//}
2827

29-
pub fn opts() -> Result<TargetOptions, String> {
30-
let l4re_lib_path = env::var_os("L4RE_LIBDIR").ok_or("Unable to find L4Re \
31-
library directory: L4RE_LIBDIR not set.")?.into_string().unwrap();
32-
let mut pre_link_args = LinkArgs::new();
33-
pre_link_args.insert(LinkerFlavor::Ld, vec![
34-
format!("-T{}/main_stat.ld", l4re_lib_path),
35-
"--defsym=__executable_start=0x01000000".to_string(),
36-
"--defsym=__L4_KIP_ADDR__=0x6ffff000".to_string(),
37-
format!("{}/crt1.o", l4re_lib_path),
38-
format!("{}/crti.o", l4re_lib_path),
39-
get_path_or("crtbeginT.o"),
40-
]);
41-
let mut post_link_args = LinkArgs::new();
42-
post_link_args.insert(LinkerFlavor::Ld, vec![
43-
format!("{}/l4f/libpthread.a", l4re_lib_path),
44-
format!("{}/l4f/libc_be_sig.a", l4re_lib_path),
45-
format!("{}/l4f/libc_be_sig_noop.a", l4re_lib_path),
46-
format!("{}/l4f/libc_be_socket_noop.a", l4re_lib_path),
47-
format!("{}/l4f/libc_be_fs_noop.a", l4re_lib_path),
48-
format!("{}/l4f/libc_be_sem_noop.a", l4re_lib_path),
49-
format!("{}/l4f/libl4re-vfs.o.a", l4re_lib_path),
50-
format!("{}/l4f/lib4re.a", l4re_lib_path),
51-
format!("{}/l4f/lib4re-util.a", l4re_lib_path),
52-
format!("{}/l4f/libc_support_misc.a", l4re_lib_path),
53-
format!("{}/l4f/libsupc++.a", l4re_lib_path),
54-
format!("{}/l4f/lib4shmc.a", l4re_lib_path),
55-
format!("{}/l4f/lib4re-c.a", l4re_lib_path),
56-
format!("{}/l4f/lib4re-c-util.a", l4re_lib_path),
57-
get_path_or("libgcc_eh.a"),
58-
format!("{}/l4f/libdl.a", l4re_lib_path),
59-
"--start-group".to_string(),
60-
format!("{}/l4f/libl4util.a", l4re_lib_path),
61-
format!("{}/l4f/libc_be_l4re.a", l4re_lib_path),
62-
format!("{}/l4f/libuc_c.a", l4re_lib_path),
63-
format!("{}/l4f/libc_be_l4refile.a", l4re_lib_path),
64-
"--end-group".to_string(),
65-
format!("{}/l4f/libl4sys.a", l4re_lib_path),
66-
"-gc-sections".to_string(),
67-
get_path_or("crtend.o"),
68-
format!("{}/crtn.o", l4re_lib_path),
69-
]);
28+
pub fn opts() -> TargetOptions {
29+
let mut args = LinkArgs::new();
30+
args.insert(LinkerFlavor::Gcc, vec![]);
7031

71-
Ok(TargetOptions {
32+
TargetOptions {
7233
executables: true,
7334
has_elf_tls: false,
7435
exe_allocation_crate: None,
7536
panic_strategy: PanicStrategy::Abort,
76-
pre_link_args,
77-
post_link_args,
37+
linker: "ld".to_string(),
38+
pre_link_args: args,
7839
target_family: Some("unix".to_string()),
7940
.. Default::default()
80-
})
41+
}
8142
}

src/librustc_back/target/x86_64_unknown_l4re_uclibc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use LinkerFlavor;
1212
use target::{Target, TargetResult};
1313

1414
pub fn target() -> TargetResult {
15-
let mut base = super::l4re_base::opts()?;
15+
let mut base = super::l4re_base::opts();
1616
base.cpu = "x86-64".to_string();
1717
base.max_atomic_width = Some(64);
1818

0 commit comments

Comments
 (0)