Skip to content

Initial symbol versioning #1955

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

Closed
wants to merge 1 commit into from
Closed
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
49 changes: 49 additions & 0 deletions config/ld-version-script.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
dnl Copyright (C) 2006-2013 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

dnl From Simon Josefsson

# FIXME: The test below returns a false positive for mingw
# cross-compiles, 'local:' statements does not reduce number of
# exported symbols in a DLL. Use --disable-ld-version-script to work
# around the problem.

# gl_LD_VERSION_SCRIPT
# --------------------
# Check if LD supports linker scripts, and define automake conditional
# HAVE_LD_VERSION_SCRIPT if so.
AC_DEFUN([gl_LD_VERSION_SCRIPT],
[
AC_ARG_ENABLE([ld-version-script],
[AS_HELP_STRING([--enable-ld-version-script],
[enable linker version script (default is enabled when possible)])],
[have_ld_version_script=$enableval],
[AC_CACHE_CHECK([if LD -Wl,--version-script works],
[gl_cv_sys_ld_version_script],
[gl_cv_sys_ld_version_script=no
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
echo foo >conftest.map
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[],
[cat > conftest.map <<EOF
VERS_1 {
global: sym;
};

VERS_2 {
global: sym;
} VERS_1;
EOF
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[gl_cv_sys_ld_version_script=yes])])
rm -f conftest.map
LDFLAGS=$save_LDFLAGS])
have_ld_version_script=$gl_cv_sys_ld_version_script])
AM_CONDITIONAL([HAVE_LD_VERSION_SCRIPT],
[test "$have_ld_version_script" = yes])
])

gl_LD_VERSION_SCRIPT()
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ if test "$enable_binaries" = "no" && test "$enable_dist" = "yes"; then
AC_MSG_ERROR([Cannot continue])
fi

m4_include([config/ld-version-script.m4])

# The library prefixes must be set before we call OPAL MCA. Here is
# as good a place as any.
OPAL_SET_LIB_PREFIX([])
Expand Down
5 changes: 4 additions & 1 deletion ompi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ SUBDIRS = \
mpi/cxx \
$(OMPI_MPIEXT_MPIFH_DIRS) \
mpi/fortran/mpif-h \
$(OMPI_MPIEXT_USEMPI_DIR) \
$(OMPI_FORTRAN_USEMPI_DIR) \
$(OMPI_MPIEXT_USEMPIF08_DIRS) \
$(OMPI_FORTRAN_USEMPIF08_DIR) \
Expand Down Expand Up @@ -154,6 +153,10 @@ libmpi_la_LDFLAGS = \
-version-info $(libmpi_so_version) \
$(OMPI_LIBMPI_EXTRA_LDFLAGS)

if HAVE_LD_VERSION_SCRIPT
libmpi_la_LDFLAGS += -Wl,--version-script=$(top_srcdir)/ompi/libmpi.map
endif

# included subdirectory Makefile.am's and appended-to variables
headers =
noinst_LTLIBRARIES =
Expand Down
Loading