diff --git a/libc-test/build.rs b/libc-test/build.rs
index dab69ecf0351cf2e3ef74803e82a096a943dedda..2c0d5853623487492bb79878e83e49fd72cce52d 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -132,6 +132,7 @@ fn main() {
 
     if linux {
         cfg.header("mqueue.h");
+        cfg.header("ucontext.h");
         cfg.header("sys/signalfd.h");
         cfg.header("sys/xattr.h");
         cfg.header("sys/ipc.h");
@@ -350,10 +351,6 @@ fn main() {
             // they're implemented on rumprun yet, just let them slide for now.
             // Some of them look like they have headers but then don't have
             // corresponding actual definitions either...
-            "backtrace" |
-            "pthread_main_np" |
-            "pthread_set_name_np" |
-            "pthread_stackseg_np" |
             "shm_open" |
             "shm_unlink" |
             "syscall" |
diff --git a/src/lib.rs b/src/lib.rs
index c9d7701aa652525e20e8c410bc4f629367d12706..57919c59f96dcf49b72c39777129a26dd7705507 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -74,7 +74,7 @@
 ))]
 
 // Attributes needed when building as part of the standard library
-#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]
+#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
 #![cfg_attr(stdbuild, no_std)]
 #![cfg_attr(stdbuild, staged_api)]
 #![cfg_attr(stdbuild, allow(warnings))]
diff --git a/src/macros.rs b/src/macros.rs
index 3c2978ea206cca8e17b57c10dbad8330ce512974..5811c84c3aaa541010b7e363b52ffb311d1cd5f2 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -23,7 +23,7 @@ macro_rules! cfg_if {
 macro_rules! __cfg_if_items {
     (($($not:meta,)*) ; ) => {};
     (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
-        __cfg_if_apply! { cfg(all($($m,)* not(any($($not),*)))), $($it)* }
+        __cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
         __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
     }
 }
diff --git a/src/unix/bsd/openbsdlike/bitrig.rs b/src/unix/bsd/openbsdlike/bitrig.rs
index ab9cc9f0cc5f45b32c3a0d18ac7200e367eb88a2..b6c51dec36a6c09c967440396d49b2806d588643 100644
--- a/src/unix/bsd/openbsdlike/bitrig.rs
+++ b/src/unix/bsd/openbsdlike/bitrig.rs
@@ -227,6 +227,10 @@ extern {
                        flags: ::c_int) -> ::c_int;
     pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
+    pub fn pthread_main_np() -> ::c_int;
+    pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
+    pub fn pthread_stackseg_np(thread: ::pthread_t,
+                               sinfo: *mut ::stack_t) -> ::c_int;
     pub fn sysctl(name: *mut ::c_int,
                   namelen: ::c_uint,
                   oldp: *mut ::c_void,
diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs
index 490e8056c2759e2558988c381465c3e3d2f4b585..c0274a89d7419984644077e83159c6fd3e134ece 100644
--- a/src/unix/bsd/openbsdlike/mod.rs
+++ b/src/unix/bsd/openbsdlike/mod.rs
@@ -384,13 +384,10 @@ extern {
     pub fn __errno() -> *mut ::c_int;
     pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
                     -> ::c_int;
-    pub fn pthread_main_np() -> ::c_int;
-    pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
-    pub fn pthread_stackseg_np(thread: ::pthread_t,
-                               sinfo: *mut ::stack_t) -> ::c_int;
     pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
     pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
     pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
 }
 
 cfg_if! {
diff --git a/src/unix/bsd/openbsdlike/openbsd.rs b/src/unix/bsd/openbsdlike/openbsd.rs
index fc38478fd14f5f13e4097bfce91b2c98edd79691..73d14ea979b9e00a567f28c30cc340bab4512ced 100644
--- a/src/unix/bsd/openbsdlike/openbsd.rs
+++ b/src/unix/bsd/openbsdlike/openbsd.rs
@@ -232,6 +232,10 @@ extern {
                        flags: ::c_int) -> ::c_int;
     pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
                     -> ::c_int;
+    pub fn pthread_main_np() -> ::c_int;
+    pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
+    pub fn pthread_stackseg_np(thread: ::pthread_t,
+                               sinfo: *mut ::stack_t) -> ::c_int;
     pub fn sysctl(name: *const ::c_int,
                   namelen: ::c_uint,
                   oldp: *mut ::c_void,
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index f65efd63cea47dbaa78e12490872e3ba06cfd102..3d8363805488aff4ad26921db5324bd4513035f3 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -143,6 +143,12 @@ cfg_if! {
     } else if #[cfg(target_os = "emscripten")] {
         #[link(name = "c")]
         extern {}
+    } else if #[cfg(all(target_vendor = "rumprun", target_os = "netbsd"))] {
+        // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled in
+        // automatically by the linker. We avoid passing it explicitly, as it
+        // causes some versions of binutils to crash with an assertion failure.
+        #[link(name = "m")]
+        extern {}
     } else if #[cfg(any(target_os = "macos",
                         target_os = "ios",
                         target_os = "android",
@@ -688,6 +694,7 @@ extern {
     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
     pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
+    pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
 }
 
 cfg_if! {
diff --git a/src/unix/notbsd/linux/other/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs
index 45fa03f90dea0259a931b325f38bfcf2577b1de6..89c2433b2e0b00e1dbc2797ff411653f7bb28b38 100644
--- a/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/src/unix/notbsd/linux/other/b32/x86.rs
@@ -18,3 +18,27 @@ pub const SO_SNDTIMEO: ::c_int = 21;
 
 pub const FIOCLEX: ::c_ulong = 0x5451;
 pub const FIONBIO: ::c_ulong = 0x5421;
+
+s! {
+
+    pub struct mcontext_t {
+        __private: [u32; 22]
+    }
+
+    pub struct ucontext_t {
+        pub uc_flags: ::c_ulong,
+        pub uc_link: *mut ucontext_t,
+        pub uc_stack: ::stack_t,
+        pub uc_mcontext: mcontext_t,
+        pub uc_sigmask: ::sigset_t,
+        __private: [u8; 112],
+    }
+
+}
+
+extern {
+    pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
+    pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
+    pub fn makecontext(ucp: *mut ucontext_t, func:  extern fn (), argc: ::c_int, ...);
+    pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
+}
diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs
index fc82c71e2d8773f1ce3839a5f9faa8d238169ccb..aea629a29eaf3ccec4c9628682a56817aa6f7d9b 100644
--- a/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -79,4 +79,29 @@ s! {
     pub struct pthread_attr_t {
         __size: [u64; 7]
     }
+
+}
+
+s! {
+
+    pub struct mcontext_t {
+        __private: [u64; 32],
+    }
+
+    pub struct ucontext_t {
+        pub uc_flags: ::c_ulong,
+        pub uc_link: *mut ucontext_t,
+        pub uc_stack: ::stack_t,
+        pub uc_mcontext: mcontext_t,
+        pub uc_sigmask: ::sigset_t,
+        __private: [u8; 512],
+    }
+
+}
+
+extern {
+    pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
+    pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
+    pub fn makecontext(ucp: *mut ucontext_t, func:  extern fn (), argc: ::c_int, ...);
+    pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
 }
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index 12cff8352c8f30e76dd4d9b0f457f417933a39ba..62e4d1c2df36bba8c171221aa9eeeaad16179473 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -653,8 +653,9 @@ extern {
                     nr_segs: ::size_t,
                     flags: ::c_uint) -> ::ssize_t;
 
-    pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, 
+    pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
                          advise: ::c_int) -> ::c_int;
+    pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
 }
 
 cfg_if! {