about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Neumann <mail@timnn.me>2017-03-19 19:31:49 +0100
committerTim Neumann <mail@timnn.me>2017-03-21 20:37:50 +0100
commit43a51b78b8c24f2bd40b20d1a082db1443075c19 (patch)
tree62c479cc57868fcdd04260ed88df58febf0ade15
parentba90248dac1f3ee124623209b3eaa3e310679298 (diff)
downloadrust-43a51b78b8c24f2bd40b20d1a082db1443075c19.tar.gz
rust-43a51b78b8c24f2bd40b20d1a082db1443075c19.zip
link agains relocatable libstdc++
-rw-r--r--src/librustc_llvm/build.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs
index 7f53e21675c..42717ec289c 100644
--- a/src/librustc_llvm/build.rs
+++ b/src/librustc_llvm/build.rs
@@ -233,16 +233,21 @@ fn main() {
         }
     }
 
-    // OpenBSD has a particular C++ runtime library name
+    let llvm_static_stdcpp = env::var_os("LLVM_STATIC_STDCPP");
+
     let stdcppname = if target.contains("openbsd") {
+        // OpenBSD has a particular C++ runtime library name
         "estdc++"
+    } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() {
+        // NetBSD uses a separate library when relocation is required
+        "stdc++_pic"
     } else {
         "stdc++"
     };
 
     // C++ runtime library
     if !target.contains("msvc") {
-        if let Some(s) = env::var_os("LLVM_STATIC_STDCPP") {
+        if let Some(s) = llvm_static_stdcpp {
             assert!(!cxxflags.contains("stdlib=libc++"));
             let path = PathBuf::from(s);
             println!("cargo:rustc-link-search=native={}",