From efe449adbb8994e6333bfb018be225b46d9f4ba6 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Thu, 18 Sep 2014 21:35:30 -0400 Subject: [PATCH] Fix LT_LDLIB_shlib_missing Libtool's -symbols-file argument is taken as an exact match of symbols that this library claims to export. It does not filter based on what symbols are actually present in the objects comprising the library. Instead, if there are symbols in the file which are not implemented by the library, there is an implicit assumption that some other library will provide those symbols, which must be linked into a consumer of this library alongside this library. These are not the semantics we want (at present, only for roken), wherein a library will implement some (but probably not all) of a given list of symbols, and we want the export list to reflect only those symbols which are implemented. Instead, use the symbols file to build a regex that will only match symbols listed in the file (and no other symbols), and only export the subset which is present. Change-Id: Id81f7a35089ae7f760fe643680f9bfb9c81521aa Reviewed-on: http://gerrit.openafs.org/11475 Reviewed-by: Benjamin Kaduk Reviewed-by: D Brashear Tested-by: D Brashear --- src/config/Makefile.config.in | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/config/Makefile.config.in b/src/config/Makefile.config.in index b9ca6f1..4da9559 100644 --- a/src/config/Makefile.config.in +++ b/src/config/Makefile.config.in @@ -247,14 +247,17 @@ LT_revision=0 LT_age=0 # Basic rule to link a shared library. -LT_LDLIB_shlib_missing=$(LIBTOOL) --quiet --mode=link --tag=CC \ - $(MT_CC) -rpath $(libdir) \ - $(PTH_LDFLAGS) $(PTH_CFLAGS) $(LDFLAGS_$(@)) \ - -o $@ \ - -export-symbols ${srcdir}/$@.sym \ - -version-info $(LT_current):$(LT_revision):$(LT_age) - -LT_LDLIB_shlib=$(LT_LDLIB_shlib_missing) -no-undefined +LT_LDLIB_shlib_common=$(LIBTOOL) --quiet --mode=link --tag=CC \ + $(MT_CC) -rpath $(libdir) \ + $(PTH_LDFLAGS) $(PTH_CFLAGS) $(LDFLAGS_$(@)) \ + -o $@ \ + -version-info $(LT_current):$(LT_revision):$(LT_age) + +LT_LDLIB_shlib=$(LT_LDLIB_shlib_common) -export-symbols $(srcdir)/$@.sym + +LT_LDLIB_shlib_missing=$(LT_LDLIB_shlib_common) -export-symbols-regex \ + "($$(sed -e 's/^/^/' -e 's/$$/$$/' $(srcdir)/$@.sym | tr '\n' '|' | \ + sed -e 's/|$$//'))" # Link a static convenience library (contains no PIC code) LT_LDLIB_static=$(LIBTOOL) --quiet --mode=link --tag=CC \ -- 1.9.4