Skip to content

exported symbol name pollution test #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packaging/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2020 IBM Corporation. All rights reserved.
#
# $COPYRIGHT$
#

noinst_PROGRAMS = \
run_nmcheck

EXTRA_DIST = nmcheck_prefix.pl
62 changes: 62 additions & 0 deletions packaging/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Test for exported symbol name pollution

This runs from inside a rank and uses ldd on itself to figure out what
libraries to examine (it looks for a libmpi.so in the ldd output, and
then decides that any other libraries that come from the same directory
as libmpi.so must also be part of OMPI and should be examined too), then
nm on those MPI libraries to look for symbols without some accepted
OMPI prefix.

Example runs with good/bad output::

```
% export OPAL_PREFIX=/some/path
% export OLDPATH=$PATH
% export PATH=$OPAL_PREFIX/bin:${PATH}
% export LD_LIBRARY_PATH=$OPAL_PREFIX/lib
% autoreconf -i
% make

------------------------------------------------
*** Example of a passing run:

% $OPAL_PREFIX/bin/mpirun -np 1 ./run_nmcheck

> Checking for bad symbol names:
> *** checking /some/path/lib/libpmix.so.0
> *** checking /some/path/lib/libopen-pal.so.0
> *** checking /some/path/lib/libmpi.so.0
> *** checking /some/path/lib/libmpi_mpifh.so
> *** checking /some/path/lib/libmpi_usempif08.so
> *** checking /some/path/lib/libmpi_usempi_ignore_tkr.so

------------------------------------------------
*** Example of a failing run:

Then if I edit one of the opal C files to add a couple
extraneous globally exported symbols
int myfunction() { return 0; }
int myglobal = 123;
and rerun the test:

% $OPAL_PREFIX/bin/mpirun -np 1 ./run_nmcheck

> Checking for bad symbol names:
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libmpi.so.0
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libpmix.so.0
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libopen-pal.so.0
> [error] myfunction
> [error] myglobal
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libmpi_mpifh.so
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libmpi_usempif08.so
> *** checking /u/markalle/space/Projects/OMPIDev.m/install/lib/libmpi_usempi_ignore_tkr.so
> --------------------------------------------------------------------------
> MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
> Proc: [[27901,1],0]
> Errorcode: 16
>
> NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
> You may or may not see output from other processes, depending on
> exactly when Open MPI kills them.
> --------------------------------------------------------------------------
```
144 changes: 144 additions & 0 deletions packaging/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# -*- shell-script -*-
#
# Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2020 IBM Corporatio. All rights reserved.
#
# $COPYRIGHT$
#

dnl
dnl Init autoconf
dnl

AC_PREREQ([2.67])
AC_INIT([packaging-test], [1.0], [http://www.open-mpi.org])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([.])

echo "Configuring packaging test"

AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror])

# If Automake supports silent rules, enable them.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AH_TOP([/* -*- c -*-
*
* ompitest test suite configuation header file.
* See the top-level LICENSE file for license and copyright
* information.
*/

#ifndef OMPITEST_CONFIG_H
#define OMPITEST_CONFIG_H
])
AH_BOTTOM([#endif /* OMPITEST_CONFIG_H */])

dnl
dnl Make automake clean emacs ~ files for "make clean"
dnl

CLEANFILES="*~"
AC_SUBST(CLEANFILES)

dnl
dnl Get various programs
dnl Bias towards mpicc/mpic++/mpif77
dnl C compiler
dnl

if test "$CC" != ""; then
BASE="`basename $CC`"
else
BASE=
fi
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "cc" -o \
"$BASE" = "gcc" -o "$BASE" = "xlc" -o "$BASE" = "pgcc" -o \
"$BASE" = "icc"; then
AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no)
if test "$HAVE_MPICC" = "yes"; then
CC=mpicc
export CC
fi
fi

CFLAGS_save=$CFLAGS
AC_PROG_CC
CFLAGS=$CFLAGS_save

dnl
dnl Fortran compiler
dnl

if test "$FC" != ""; then
BASE="`basename $FC`"
else
BASE=
fi
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "f77" -o \
"$BASE" = "g77" -o "$BASE" = "f90" -o "$BASE" = "g90" -o \
"$BASE" = "xlf" -o "$BASE" = "ifc" -o "$BASE" = "pgf77"; then
AC_CHECK_PROG(HAVE_MPIFORT, mpifort, yes, no)
AS_IF([test "$HAVE_MPIFORT" = "yes"],
[FC=mpifort],
[AC_CHECK_PROG([HAVE_MPIF90], mpif90, yes, no)
AS_IF([test "$HAVE_MPIF90" = "yes"],
[FC=mpif90],
[AC_CHECK_PROG([HAVE_MPIF77], mpif77, yes, no)
AS_IF([test "$HAVE_MPIF77" = "yes"],
[FC=mpif77],
[AC_MSG_WARN([Cannot find a suitable MPI compiler])
AC_MSG_ERROR([Cannot continue])
])
])
])
export FC
fi

FCFLAGS_save=$FCFLAGS
AC_PROG_FC
FCFLAGS=$FCFLAGS_save

dnl
dnl Because these are meant to be used for debugging, after all
dnl

if test -z "$CFLAGS"; then
CFLAGS="-g"
fi
if test -z "$FCFLAGS"; then
FCFLAGS="-g";
fi
AC_SUBST(FCFLAGS)
if test -z "$FFLAGS"; then
FFLAGS="-g";
fi
AC_SUBST(FFLAGS)

dnl
dnl Ensure that we can compile and link a C MPI program
dnl

AC_LANG_PUSH([C])
AC_CHECK_HEADERS(mpi.h)

AC_MSG_CHECKING([if linking MPI program works])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>
]],
[[MPI_Comm a = MPI_COMM_WORLD]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([Simple MPI program fails to link])
AC_MSG_ERROR([Cannot continue])
])
AC_LANG_POP([C])

dnl
dnl Party on
dnl

AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
Loading