about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAli Clark <ali@clark.gb.net>2016-02-17 18:46:16 +0000
committerAli Clark <ali@clark.gb.net>2016-02-17 18:46:16 +0000
commit6115f2effeb32d76f22abac69700c9125de4bba1 (patch)
tree22ad7b57f1f7fe0bf8aaed427242fef066d37a4f
parentf4046deb20cb997a5901e90be617d0c7bfa6842e (diff)
downloadrust-6115f2effeb32d76f22abac69700c9125de4bba1.tar.gz
rust-6115f2effeb32d76f22abac69700c9125de4bba1.zip
bring freebsd linker config up-to-date (same as dragonfly)
-rw-r--r--src/librustc_back/target/freebsd_base.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/librustc_back/target/freebsd_base.rs b/src/librustc_back/target/freebsd_base.rs
index 651c2a3760a..f05319a0cbe 100644
--- a/src/librustc_back/target/freebsd_base.rs
+++ b/src/librustc_back/target/freebsd_base.rs
@@ -16,13 +16,20 @@ pub fn opts() -> TargetOptions {
         linker: "cc".to_string(),
         dynamic_linking: true,
         executables: true,
+        linker_is_gnu: true,
         has_rpath: true,
-        pre_link_args: vec![
+        pre_link_args: vec!(
+            // GNU-style linkers will use this to omit linking to libraries
+            // which don't actually fulfill any relocations, but only for
+            // libraries which follow this flag.  Thus, use it before
+            // specifying libraries to link to.
+            "-Wl,--as-needed".to_string(),
+
             // Always enable NX protection when it is available
             "-Wl,-z,noexecstack".to_string(),
-        ],
+        ),
+        position_independent_executables: true,
         exe_allocation_crate: super::maybe_jemalloc(),
-
         .. Default::default()
     }
 }