Skip to content

Commit 7205a54

Browse files
committed
---
yaml --- r: 216325 b: refs/heads/stable c: d098517 h: refs/heads/master i: 216323: 2e29ca2 v: v3
1 parent 3cc0eff commit 7205a54

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 22da16a4c5b22feac0be1fe34795c5781392bb33
32+
refs/heads/stable: d09851730c47f49555c84b76dd6e71d91b0555ed
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/librustc_back/target/mod.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,22 @@ pub struct Target {
9191
pub struct TargetOptions {
9292
/// Linker to invoke. Defaults to "cc".
9393
pub linker: String,
94-
/// Linker arguments that are unconditionally passed *before* any user-defined libraries.
94+
/// Linker arguments that are unconditionally passed *before* any
95+
/// user-defined libraries.
9596
pub pre_link_args: Vec<String>,
96-
/// Linker arguments that are unconditionally passed *after* any user-defined libraries.
97+
/// Linker arguments that are unconditionally passed *after* any
98+
/// user-defined libraries.
9799
pub post_link_args: Vec<String>,
98-
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults to "default".
100+
/// Objects to link before and after all others, always found within the
101+
/// sysroot folder.
102+
pub pre_link_objects: Vec<String>,
103+
pub post_link_objects: Vec<String>,
104+
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
105+
/// to "default".
99106
pub cpu: String,
100-
/// Default target features to pass to LLVM. These features will *always* be passed, and cannot
101-
/// be disabled even via `-C`. Corresponds to `llc -mattr=$features`.
107+
/// Default target features to pass to LLVM. These features will *always* be
108+
/// passed, and cannot be disabled even via `-C`. Corresponds to `llc
109+
/// -mattr=$features`.
102110
pub features: String,
103111
/// Whether dynamic linking is available on this target. Defaults to false.
104112
pub dynamic_linking: bool,
@@ -183,6 +191,8 @@ impl Default for TargetOptions {
183191
has_rpath: false,
184192
no_compiler_rt: false,
185193
position_independent_executables: false,
194+
pre_link_objects: Vec::new(),
195+
post_link_objects: Vec::new(),
186196
}
187197
}
188198
}

branches/stable/src/librustc_back/target/x86_64_unknown_linux_musl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use target::Target;
1313
pub fn target() -> Target {
1414
let mut base = super::linux_base::opts();
1515
base.cpu = "x86-64".to_string();
16-
base.linker = "musl-gcc".to_string();
1716
base.pre_link_args.push("-m64".to_string());
1817

1918
// Make sure that the linker/gcc really don't pull in anything, including

branches/stable/src/librustc_trans/back/link.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,21 @@ fn link_natively(sess: &Session, trans: &CrateTranslation, dylib: bool,
794794
let pname = get_cc_prog(sess);
795795
let mut cmd = Command::new(&pname[..]);
796796

797+
let root = sess.target_filesearch(PathKind::Native).get_lib_path();
797798
cmd.args(&sess.target.target.options.pre_link_args);
799+
for obj in &sess.target.target.options.pre_link_objects {
800+
cmd.arg(root.join(obj));
801+
}
802+
798803
link_args(&mut cmd, sess, dylib, tmpdir.path(),
799804
trans, obj_filename, out_filename);
800-
cmd.args(&sess.target.target.options.post_link_args);
801805
if !sess.target.target.options.no_compiler_rt {
802806
cmd.arg("-lcompiler-rt");
803807
}
808+
for obj in &sess.target.target.options.post_link_objects {
809+
cmd.arg(root.join(obj));
810+
}
811+
cmd.args(&sess.target.target.options.post_link_args);
804812

805813
if sess.opts.debugging_opts.print_link_args {
806814
println!("{:?}", &cmd);

0 commit comments

Comments
 (0)