MTT is your friend: Cisco tests --enable-static --disable-shared, but
we had already tested this scenario manually to know that it seemed to be working. What we ''didn't'' test was --enable-static --disable-shared --disable-dlopen -- but my MTT '''did.''' Yay! This commit fixes that scenario. Essentially we need to call a dummy function in hooks.c to ensure that the linker pulls in all those symbols into the final executable (and therefore pulls in the malloc_initialize_hook, etc.). Thanks for the heads-up from Brian in fixing this one! This commit was SVN r21022.
Этот коммит содержится в:
родитель
20faf6a1a9
Коммит
35fc9fedd2
@ -647,7 +647,7 @@ public_sET_STATe(Void_t* msptr)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
Per
|
||||
OMPI change: Per
|
||||
http://www.gnu.org/software/libc/manual/html_mono/libc.html#Hooks-for-Malloc,
|
||||
we can define the __malloc_initialize_hook variable to be a
|
||||
function that is invoked before the first allocation is ever
|
||||
@ -781,6 +781,23 @@ static void opal_memory_ptmalloc2_malloc_init_hook(void)
|
||||
}
|
||||
|
||||
|
||||
/* OMPI change: add a dummy function here that will be called by the
|
||||
ptmalloc2 component open() function. This dummy function is
|
||||
necessary for when OMPI is built as --disable-shared
|
||||
--enable-static --disable-dlopen, because we won't use
|
||||
-Wl,--export-dynamic when building OMPI. So we need to ensure that
|
||||
not only that all the symbols in this file end up in libmpi.a, but
|
||||
they also end up in the final exectuable (so that
|
||||
__malloc_initialize_hook is there, overrides the weak symbol in
|
||||
glibc, ....etc. */
|
||||
static int bogus = 37;
|
||||
void *opal_memory_ptmalloc2_hook_pull(void)
|
||||
{
|
||||
return &bogus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* OMPI change: This is the symbol to override to make the above
|
||||
function get fired during malloc initialization time. */
|
||||
void (*__malloc_initialize_hook) (void) =
|
||||
|
@ -31,6 +31,13 @@
|
||||
#include "opal/mca/memory/memory.h"
|
||||
#include "opal/memoryhooks/memory.h"
|
||||
|
||||
/* Need to call a function in hooks.c to ensure that all those symbols
|
||||
get pulled in at link time (e.g., when building libmpi.a, so that
|
||||
those symbols end up in the final executable -- especially if we
|
||||
use --disable-dlopen and therefore -Wl,--export-dynamic isn't used
|
||||
when we build OMPI). */
|
||||
extern void *opal_memory_ptmalloc2_hook_pull(void);
|
||||
|
||||
static int ptmalloc2_open(void);
|
||||
|
||||
const opal_memory_base_component_2_0_0_t mca_memory_ptmalloc2_component = {
|
||||
@ -67,6 +74,11 @@ static int ptmalloc2_open(void)
|
||||
void *p;
|
||||
int val = 0;
|
||||
|
||||
/* Call a dummy function in hooks.c. ***Do not remove this
|
||||
call!*** See comment at the beginning of this file explaining
|
||||
why it is here. */
|
||||
p = opal_memory_ptmalloc2_hook_pull();
|
||||
|
||||
/* We will also provide malloc/free support if we've been
|
||||
activated. We don't rely on the __malloc_initialize_hook()
|
||||
previously being called because it's possible that our hook was
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user