|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -use PanicStrategy; |
12 | 11 | use LinkerFlavor; |
| 12 | +use PanicStrategy; |
13 | 13 | use target::{LinkArgs, TargetOptions}; |
14 | 14 | use std::default::Default; |
15 | | -use std::env; |
16 | | -use std::process::Command; |
| 15 | +//use std::process::Command; |
17 | 16 |
|
18 | 17 | // Use GCC to locate code for crt* libraries from the host, not from L4Re. Note |
19 | 18 | // that a few files also come from L4Re, for these, the function shouldn't be |
20 | 19 | // 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 | +//} |
28 | 27 |
|
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![]); |
70 | 31 |
|
71 | | - Ok(TargetOptions { |
| 32 | + TargetOptions { |
72 | 33 | executables: true, |
73 | 34 | has_elf_tls: false, |
74 | 35 | exe_allocation_crate: None, |
75 | 36 | panic_strategy: PanicStrategy::Abort, |
76 | | - pre_link_args, |
77 | | - post_link_args, |
| 37 | + linker: "ld".to_string(), |
| 38 | + pre_link_args: args, |
78 | 39 | target_family: Some("unix".to_string()), |
79 | 40 | .. Default::default() |
80 | | - }) |
| 41 | + } |
81 | 42 | } |
0 commit comments