From 0579535d4914f6b2397ce5637b5dd6b3f81ec0b4 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 15 Jun 2016 12:00:49 -0600 Subject: [PATCH] opal/memory: disable __malloc_initialize_hook if poisoned Newer versions of gcc have "poisoned" the __malloc_initialize_hook name and it can no longer be used. Added a configure check and protection around its usage. Signed-off-by: Nathan Hjelm (cherry picked from open-mpi/ompi@7018aeda2b4c771c80b90a8beb0ca4194cb36076) Signed-off-by: Nathan Hjelm --- configure.ac | 2 +- ompi/runtime/ompi_mpi_init.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fcc6c930ee..b527637924 100644 --- a/configure.ac +++ b/configure.ac @@ -838,7 +838,7 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m]) # -lrt might be needed for clock_gettime OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt]) -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]) +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]) # Sanity check: ensure that we got at least one of statfs or statvfs. if test $ac_cv_func_statfs = no && test $ac_cv_func_statvfs = no; then diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 05b35e0aa9..87b7ba2ae3 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -93,6 +93,8 @@ #include "ompi/dpm/dpm.h" #include "ompi/mpiext/mpiext.h" +/* newer versions of gcc have poisoned this deprecated feature */ +#if HAVE___MALLOC_INITIALIZE_HOOK #include "opal/mca/memory/base/base.h" /* So this sucks, but with OPAL in its own library that is brought in implicity from libmpi, there are times when the malloc initialize @@ -100,6 +102,7 @@ from here, since any MPI code is going to call MPI_Init... */ OPAL_DECLSPEC void (*__malloc_initialize_hook) (void) = opal_memory_base_malloc_init_hook; +#endif /* This is required for the boundaries of the hash tables used to store * the F90 types returned by the MPI_Type_create_f90_XXX functions.