Skip to content

Commit 143c253

Browse files
committed
jemalloc-sys: hardening strerror_r function detection
test on strerror_r can fail due to reasons other than strerror_r itself, so add an additional test to determine the failure is expected. Also remove stale arch condition. Close #108. Signed-off-by: Jay Lee <[email protected]>
1 parent 8c926d5 commit 143c253

File tree

4 files changed

+38
-5
lines changed

4 files changed

+38
-5
lines changed

jemalloc-ctl/src/macros.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ macro_rules! r {
6363

6464
#[cfg(test)]
6565
#[test]
66-
#[cfg(not(target_arch = "mips64el"))]
6766
#[allow(unused)]
6867
fn [<$id _read_test>]() {
6968
match stringify!($id) {
@@ -112,7 +111,6 @@ macro_rules! w {
112111

113112
#[cfg(test)]
114113
#[test]
115-
#[cfg(not(target_arch = "mips64el"))]
116114
fn [<$id _write_test>]() {
117115
match stringify!($id) {
118116
"background_thread" |
@@ -161,7 +159,6 @@ macro_rules! u {
161159

162160
#[cfg(test)]
163161
#[test]
164-
#[cfg(not(target_arch = "mips64el"))]
165162
#[allow(unused)]
166163
fn [<$id _update_test>]() {
167164
match stringify!($id) {

jemalloc-ctl/src/raw.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ union MaybeUninit<T: Copy> {
385385
mod tests {
386386
use super::*;
387387
#[test]
388-
#[cfg(not(target_arch = "mips64el"))] // FIXME: SIGFPE
389388
fn test_ptr2str() {
390389
unsafe {
391390
//{ // This is undefined behavior:

jemalloc-sys/configure/configure

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14143,6 +14143,41 @@ fi
1414314143
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_strerror_r_returns_char_with_gnu_source" >&5
1414414144
$as_echo "$je_cv_strerror_r_returns_char_with_gnu_source" >&6; }
1414514145

14146+
if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xno" ; then
14147+
14148+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r header only is compilable" >&5
14149+
$as_echo_n "checking whether strerror_r header only is compilable... " >&6; }
14150+
if ${je_cv_strerror_r_header_pass+:} false; then :
14151+
$as_echo_n "(cached) " >&6
14152+
else
14153+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
14154+
/* end confdefs.h. */
14155+
14156+
#include <errno.h>
14157+
#include <stdio.h>
14158+
#include <stdlib.h>
14159+
#include <string.h>
14160+
14161+
int
14162+
main ()
14163+
{
14164+
14165+
;
14166+
return 0;
14167+
}
14168+
_ACEOF
14169+
if ac_fn_c_try_link "$LINENO"; then :
14170+
je_cv_strerror_r_header_pass=yes
14171+
else
14172+
je_cv_strerror_r_header_pass=no
14173+
fi
14174+
rm -f core conftest.err conftest.$ac_objext \
14175+
conftest$ac_exeext conftest.$ac_ext
14176+
fi
14177+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_strerror_r_header_pass" >&5
14178+
$as_echo "$je_cv_strerror_r_header_pass" >&6; }
14179+
14180+
fi
1414614181
CONFIGURE_CFLAGS="${SAVED_CONFIGURE_CFLAGS}"
1414714182
if test "x${CONFIGURE_CFLAGS}" = "x" -o "x${SPECIFIED_CFLAGS}" = "x" ; then
1414814183
CFLAGS="${CONFIGURE_CFLAGS}${SPECIFIED_CFLAGS}"
@@ -14155,6 +14190,8 @@ if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then
1415514190

1415614191
$as_echo "#define JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE " >>confdefs.h
1415714192

14193+
elif test "x${je_cv_strerror_r_header_pass}" = "xno" ; then
14194+
as_fn_error $? "cannot determine return type of strerror_r" "$LINENO" 5
1415814195
fi
1415914196

1416014197
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5

jemalloc-sys/jemalloc

0 commit comments

Comments
 (0)