Mpich hindexed workraound does not work with static linking
Neither a generic user application nor YAXT itself calls the yaksi/yaksa
functions from the generated mpich_workaround.c
. Therefore, the mpich_workaround.o
from libyaxt_c.a
is not picked up by the linker and the MPICH library happily uses its own bugged versions of the functions. This is why, I guess, test_ut_run
fails.
I see two and a half solutions to the problem:
- Install
mpich_workaround.o
to the/prefix/lib
and tell the users that they are supposed to include this object file in their executables when linking to YAXT. - Introduce a dependency of a core object file (a file that is always needed whenever YAXT is used) on
mpich_workaround.o
. For example, we can extendmpich_workaround.c
with an additional stringvoid xt_mpi_workaround_dummy() {}
and add one of the following toxt_init.c
:- introduce a dependency between the translation units without making redundant calls to the dummy function at the runtime:
#ifdef WHATEVER_NEW_MACRO void xt_mpi_workaround_dummy(); void xt_mpi_workaround_trigger() { xt_mpi_workaround_dummy(); } #endif
- introduce the dependency that should not get optimized out by whatever smart linker:
#ifdef WHATEVER_NEW_MACRO void xt_mpi_workaround_dummy(); #endif ... void xt_finalize(void) { ... #ifdef WHATEVER_NEW_MACRO xt_mpi_workaround_dummy(); #endif }
- introduce a dependency between the translation units without making redundant calls to the dummy function at the runtime: