Skip to content

Commit 8fe45f2

Browse files
committed
---
yaml --- r: 210022 b: refs/heads/try c: d098517 h: refs/heads/master v: v3
1 parent 1025294 commit 8fe45f2

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 22da16a4c5b22feac0be1fe34795c5781392bb33
5+
refs/heads/try: d09851730c47f49555c84b76dd6e71d91b0555ed
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/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/try/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/try/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)