about summary refs log tree commit diff
path: root/src/librustc_trans
diff options
context:
space:
mode:
authorJohannes Nixdorf <mixi@exherbo.org>2018-04-29 11:29:05 +0200
committerJohannes Nixdorf <mixi@exherbo.org>2018-05-01 15:38:41 +0200
commit6d9154a830dd9773fe8a4e34e1fc3dfb1ca6f935 (patch)
tree1310f5e7b4f930b3b4800e3062c129861d16283c /src/librustc_trans
parentec2b861c2f8013e10ab1f6e01c9aed9ad1daaefe (diff)
downloadrust-6d9154a830dd9773fe8a4e34e1fc3dfb1ca6f935.tar.gz
rust-6d9154a830dd9773fe8a4e34e1fc3dfb1ca6f935.zip
musl: link crt{begin,end}.o from the system compiler
This fixes #36710 with +crt-static. We only need to add crtbegin.o and
crtend.o as we only do static linking with the bundled start files and
there is no static-pie support in rustc yet.
Diffstat (limited to 'src/librustc_trans')
-rw-r--r--src/librustc_trans/back/link.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index 67925178927..07dfeda3b5a 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -644,6 +644,12 @@ fn link_natively(sess: &Session,
         for obj in &sess.target.target.options.pre_link_objects_exe_crt {
             cmd.arg(root.join(obj));
         }
+
+        for obj in &sess.target.target.options.pre_link_objects_exe_crt_sys {
+            if flavor == LinkerFlavor::Gcc {
+                cmd.arg(format!("-l:{}", obj));
+            }
+        }
     }
 
     if sess.target.target.options.is_like_emscripten {
@@ -668,6 +674,11 @@ fn link_natively(sess: &Session,
         cmd.arg(root.join(obj));
     }
     if sess.crt_static() {
+        for obj in &sess.target.target.options.post_link_objects_crt_sys {
+            if flavor == LinkerFlavor::Gcc {
+                cmd.arg(format!("-l:{}", obj));
+            }
+        }
         for obj in &sess.target.target.options.post_link_objects_crt {
             cmd.arg(root.join(obj));
         }