Skip to content

Commit e135543

Browse files
authored
Merge pull request #1785 from hjelmn/malloc_hook_fix
opal/memory: disable __malloc_initialize_hook if poisoned
2 parents 259c2d9 + 7018aed commit e135543

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m])
854854
# -lrt might be needed for clock_gettime
855855
OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt])
856856

857-
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv])
857+
AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook])
858858

859859
# Sanity check: ensure that we got at least one of statfs or statvfs.
860860
if test $ac_cv_func_statfs = no && test $ac_cv_func_statvfs = no; then

ompi/runtime/ompi_mpi_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,16 @@
9999
#endif
100100
#include "ompi/runtime/ompi_cr.h"
101101

102+
/* newer versions of gcc have poisoned this deprecated feature */
103+
#if HAVE___MALLOC_INITIALIZE_HOOK
102104
#include "opal/mca/memory/base/base.h"
103105
/* So this sucks, but with OPAL in its own library that is brought in
104106
implicity from libmpi, there are times when the malloc initialize
105107
hook in the memory component doesn't work. So we have to do it
106108
from here, since any MPI code is going to call MPI_Init... */
107109
OPAL_DECLSPEC void (*__malloc_initialize_hook) (void) =
108110
opal_memory_base_malloc_init_hook;
111+
#endif
109112

110113
/* This is required for the boundaries of the hash tables used to store
111114
* the F90 types returned by the MPI_Type_create_f90_XXX functions.

0 commit comments

Comments
 (0)