]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #20024 : mneumann/rust/dragonfly-fixes3, r=alexcrichton
authorbors <bors@rust-lang.org>
Thu, 25 Dec 2014 05:11:36 +0000 (05:11 +0000)
committerbors <bors@rust-lang.org>
Thu, 25 Dec 2014 05:11:36 +0000 (05:11 +0000)
1  2 
src/librustc_back/rpath.rs
src/libstd/sys/unix/os.rs

index 1056ac928e687e7f996c9c5830c3225bb4144c8e,10ba023c6193dd55dfaa1273de3bc60c97047c17..955081a3af64c62b1fbd244d03612051754fe0ac
@@@ -44,15 -44,15 +44,15 @@@ pub fn get_rpath_flags<F, G>(config: RP
          l.map(|p| p.clone())
      }).collect::<Vec<_>>();
  
 -    let rpaths = get_rpaths(config, libs.as_slice());
 -    flags.push_all(rpaths_to_flags(rpaths.as_slice()).as_slice());
 +    let rpaths = get_rpaths(config, libs[]);
 +    flags.push_all(rpaths_to_flags(rpaths[])[]);
      flags
  }
  
  fn rpaths_to_flags(rpaths: &[String]) -> Vec<String> {
      let mut ret = Vec::new();
      for rpath in rpaths.iter() {
 -        ret.push(format!("-Wl,-rpath,{}", (*rpath).as_slice()));
 +        ret.push(format!("-Wl,-rpath,{}", (*rpath)[]));
      }
      return ret;
  }
@@@ -82,14 -82,14 +82,14 @@@ fn get_rpaths<F, G>(mut config: RPathCo
          }
      }
  
 -    log_rpaths("relative", rel_rpaths.as_slice());
 -    log_rpaths("fallback", fallback_rpaths.as_slice());
 +    log_rpaths("relative", rel_rpaths[]);
 +    log_rpaths("fallback", fallback_rpaths[]);
  
      let mut rpaths = rel_rpaths;
 -    rpaths.push_all(fallback_rpaths.as_slice());
 +    rpaths.push_all(fallback_rpaths[]);
  
      // Remove duplicates
 -    let rpaths = minimize_rpaths(rpaths.as_slice());
 +    let rpaths = minimize_rpaths(rpaths[]);
      return rpaths;
  }
  
@@@ -140,7 -140,7 +140,7 @@@ fn minimize_rpaths(rpaths: &[String]) -
      let mut set = HashSet::new();
      let mut minimized = Vec::new();
      for rpath in rpaths.iter() {
 -        if set.insert(rpath.as_slice()) {
 +        if set.insert(rpath[]) {
              minimized.push(rpath.clone());
          }
      }
@@@ -215,22 -215,7 +215,7 @@@ mod test 
      }
  
      #[test]
-     #[cfg(target_os = "freebsd")]
-     fn test_rpath_relative() {
-         let config = &mut RPathConfig {
-             used_crates: Vec::new(),
-             has_rpath: true,
-             is_like_osx: false,
-             out_filename: Path::new("bin/rustc"),
-             get_install_prefix_lib_path: || panic!(),
-             realpath: |p| Ok(p.clone())
-         };
-         let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so"));
-         assert_eq!(res, "$ORIGIN/../lib");
-     }
-     #[test]
-     #[cfg(target_os = "dragonfly")]
+     #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
      fn test_rpath_relative() {
          let config = &mut RPathConfig {
              used_crates: Vec::new(),
index 316d97064eeca0ccb91424df417be4c8db4338e5,f1663df6a9b5c2088e4546893309f3e3add077af..cafe52f8403b6d312c1d6c66f079d49b7c76a92b
@@@ -16,8 -16,8 +16,8 @@@ use error::{FromError, Error}
  use fmt;
  use io::{IoError, IoResult};
  use libc::{mod, c_int, c_char, c_void};
 -use path::{Path, GenericPath, BytesContainer};
 -use ptr::{mod, RawPtr};
 +use path::BytesContainer;
 +use ptr;
  use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst};
  use sys::fs::FileDesc;
  use os;
@@@ -172,7 -172,7 +172,7 @@@ pub fn join_paths<T: BytesContainer>(pa
      Ok(joined)
  }
  
- #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+ #[cfg(target_os = "freebsd")]
  pub fn load_self() -> Option<Vec<u8>> {
      unsafe {
          use libc::funcs::bsd44::*;
          if sz == 0 { return None; }
          let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
          let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
 -                         v.as_mut_ptr() as *mut c_void, &mut sz,
 +                         v.as_mut_ptr() as *mut libc::c_void, &mut sz,
                           ptr::null_mut(), 0u as libc::size_t);
          if err != 0 { return None; }
          if sz == 0 { return None; }
      }
  }
  
+ #[cfg(target_os = "dragonfly")]
+ pub fn load_self() -> Option<Vec<u8>> {
+     use std::io;
+     match io::fs::readlink(&Path::new("/proc/curproc/file")) {
+         Ok(path) => Some(path.into_vec()),
+         Err(..) => None
+     }
+ }
  #[cfg(any(target_os = "linux", target_os = "android"))]
  pub fn load_self() -> Option<Vec<u8>> {
      use std::io;