Skip to content

Commit d8a037c

Browse files
committed
Merge branch 'various-rumprun-fixes' of https://github.com/gandro/libc into merge
2 parents 2a48d49 + 35420e2 commit d8a037c

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

libc-test/build.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,6 @@ fn main() {
350350
// they're implemented on rumprun yet, just let them slide for now.
351351
// Some of them look like they have headers but then don't have
352352
// corresponding actual definitions either...
353-
"backtrace" |
354-
"pthread_main_np" |
355-
"pthread_set_name_np" |
356-
"pthread_stackseg_np" |
357353
"shm_open" |
358354
"shm_unlink" |
359355
"syscall" |

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
))]
7575

7676
// Attributes needed when building as part of the standard library
77-
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute))]
77+
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
7878
#![cfg_attr(stdbuild, no_std)]
7979
#![cfg_attr(stdbuild, staged_api)]
8080
#![cfg_attr(stdbuild, allow(warnings))]

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ macro_rules! cfg_if {
2323
macro_rules! __cfg_if_items {
2424
(($($not:meta,)*) ; ) => {};
2525
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
26-
__cfg_if_apply! { cfg(all($($m,)* not(any($($not),*)))), $($it)* }
26+
__cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
2727
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
2828
}
2929
}

src/unix/bsd/openbsdlike/bitrig.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ extern {
227227
flags: ::c_int) -> ::c_int;
228228
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
229229
-> ::c_int;
230+
pub fn pthread_main_np() -> ::c_int;
231+
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
232+
pub fn pthread_stackseg_np(thread: ::pthread_t,
233+
sinfo: *mut ::stack_t) -> ::c_int;
230234
pub fn sysctl(name: *mut ::c_int,
231235
namelen: ::c_uint,
232236
oldp: *mut ::c_void,

src/unix/bsd/openbsdlike/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,6 @@ extern {
384384
pub fn __errno() -> *mut ::c_int;
385385
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
386386
-> ::c_int;
387-
pub fn pthread_main_np() -> ::c_int;
388-
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
389-
pub fn pthread_stackseg_np(thread: ::pthread_t,
390-
sinfo: *mut ::stack_t) -> ::c_int;
391387
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
392388
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
393389
pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;

src/unix/bsd/openbsdlike/openbsd.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ extern {
232232
flags: ::c_int) -> ::c_int;
233233
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
234234
-> ::c_int;
235+
pub fn pthread_main_np() -> ::c_int;
236+
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
237+
pub fn pthread_stackseg_np(thread: ::pthread_t,
238+
sinfo: *mut ::stack_t) -> ::c_int;
235239
pub fn sysctl(name: *const ::c_int,
236240
namelen: ::c_uint,
237241
oldp: *mut ::c_void,

src/unix/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ cfg_if! {
143143
} else if #[cfg(target_os = "emscripten")] {
144144
#[link(name = "c")]
145145
extern {}
146+
} else if #[cfg(all(target_vendor = "rumprun", target_os = "netbsd"))] {
147+
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled in
148+
// automatically by the linker. We avoid passing it explicitly, as it
149+
// causes some versions of binutils to crash with an assertion failure.
150+
#[link(name = "m")]
151+
extern {}
146152
} else if #[cfg(any(target_os = "macos",
147153
target_os = "ios",
148154
target_os = "android",

0 commit comments

Comments
 (0)