From 35322718774ee54e85707c67147eb5347ce31eee Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 10 Feb 2005 03:38:18 +0000 Subject: [PATCH] Ensure that in static builds, we only include the common sm object files once. Turns out that linkers *aren't* smart enough to just "figure it out" and ensure that we only get one copy (or perhaps it's libtool who's trying to be too smart...?). This commit was SVN r4371. --- src/mca/coll/sm/Makefile.am | 13 +++++++++---- src/mca/mpool/sm/Makefile.am | 26 ++++---------------------- src/mca/ptl/sm/src/Makefile.am | 23 +---------------------- 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/src/mca/coll/sm/Makefile.am b/src/mca/coll/sm/Makefile.am index 94965aad38..69332b5c3a 100644 --- a/src/mca/coll/sm/Makefile.am +++ b/src/mca/coll/sm/Makefile.am @@ -43,18 +43,23 @@ sources = \ # mca__.la (for DSO builds) or libmca__.la # (for static builds). -if OMPI_BUILD_coll_sm_DSO component_noinst = -component_install = mca_coll_sm.la -else -component_noinst = libmca_coll_sm.la component_install = +if OMPI_BUILD_coll_sm_DSO +component_install += mca_coll_sm.la +else +component_noinst += libmca_coll_sm.la endif +# See src/mca/ptl/sm/Makefile.am for an explanation of +# libmca_common_sm.la. + mcacomponentdir = $(libdir)/openmpi mcacomponent_LTLIBRARIES = $(component_install) mca_coll_sm_la_SOURCES = $(sources) mca_coll_sm_la_LDFLAGS = -module -avoid-version +mca_coll_sm_la_LIBADD = \ + $(top_ompi_builddir)/src/mca/common/sm/libmca_common_sm.la noinst_LTLIBRARIES = $(component_noinst) libmca_coll_sm_la_SOURCES =$(sources) diff --git a/src/mca/mpool/sm/Makefile.am b/src/mca/mpool/sm/Makefile.am index 45c2061592..63c1082623 100644 --- a/src/mca/mpool/sm/Makefile.am +++ b/src/mca/mpool/sm/Makefile.am @@ -12,25 +12,6 @@ # $HEADER$ # -# A word of explanation... -# -# We link this component to common/sm/libmca_common_sm.la. This is -# because all shared-memory based components (e.g., mpool, ptl, etc.) -# need to share some common code and data. There's two cases: -# -# 1. libmca_common_sm.la is a shared library. By linking that shared -# library to all components that need it, the OS linker will -# automatically load it into the process as necessary, and there will -# only be one copy (i.e., all the components will share *one* copy of -# the code and data). -# -# 2. libmca_common_sm.la is a static library. In this case, it will -# be rolled up into the top-level libmpi.la. It will also be rolled -# into each component, but then the component will also be rolled up -# into the upper-level libmpi.la. Linkers universally know how to -# "figure this out" so that we end up with only one copy of the code -# and data. - # Use the top-level Makefile.options include $(top_ompi_srcdir)/config/Makefile.options @@ -52,15 +33,16 @@ component_noinst = libmca_mpool_sm.la component_install = endif -common = $(top_ompi_builddir)/src/mca/common/sm/libmca_common_sm.la +# See src/mca/ptl/sm/Makefile.am for an explanation of +# libmca_common_sm.la. mcacomponentdir = $(libdir)/openmpi mcacomponent_LTLIBRARIES = $(component_install) mca_mpool_sm_la_SOURCES = $(sources) mca_mpool_sm_la_LDFLAGS = -module -avoid-version -mca_mpool_sm_la_LIBADD = $(common) +mca_mpool_sm_la_LIBADD = \ + $(top_ompi_builddir)/src/mca/common/sm/libmca_common_sm.la noinst_LTLIBRARIES = $(component_noinst) libmca_mpool_sm_la_SOURCES = $(sources) libmca_mpool_sm_la_LDFLAGS = -module -avoid-version -libmca_mpool_sm_la_LIBADD = $(common) diff --git a/src/mca/ptl/sm/src/Makefile.am b/src/mca/ptl/sm/src/Makefile.am index 4bd6e02d57..98228b9585 100644 --- a/src/mca/ptl/sm/src/Makefile.am +++ b/src/mca/ptl/sm/src/Makefile.am @@ -12,31 +12,10 @@ # $HEADER$ # -# A word of explanation... -# -# We link this component to common/sm/libmca_common_sm.la. This is -# because all shared-memory based components (e.g., mpool, ptl, etc.) -# need to share some common code and data. There's two cases: -# -# 1. libmca_common_sm.la is a shared library. By linking that shared -# library to all components that need it, the OS linker will -# automatically load it into the process as necessary, and there will -# only be one copy (i.e., all the components will share *one* copy of -# the code and data). -# -# 2. libmca_common_sm.la is a static library. In this case, it will -# be rolled up into the top-level libmpi.la. It will also be rolled -# into each component, but then the component will also be rolled up -# into the upper-level libmpi.la. Linkers universally know how to -# "figure this out" so that we end up with only one copy of the code -# and data. - include $(top_ompi_srcdir)/config/Makefile.options noinst_LTLIBRARIES = libmca_ptl_sm.la librecompile.la -libmca_ptl_sm_la_LIBADD = \ - librecompile.la \ - $(top_ompi_builddir)/src/mca/common/sm/libmca_common_sm.la +libmca_ptl_sm_la_LIBADD = librecompile.la libmca_ptl_sm_la_SOURCES = \ ptl_sm.c \ ptl_sm.h \