diff options
author | David Bremner <bremner@debian.org> | 2011-06-21 21:25:06 -0300 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2011-06-23 07:04:56 -0300 |
commit | cdf1c70ab359772c1e89678e23614489596ba9eb (patch) | |
tree | 369e232328c12b3858f05532ba35be774ee995ad /lib | |
parent | de35a0e7f9efc9381652af4e381c1ac4c8a15c94 (diff) |
libnotmuch: add linker script to declare only notmuch_* symbols as global.
This is closely tied to gcc and particularly gnu ld, but I guess the
shared library linking code would need to be adjusted to work on a
non-gnu linker anyay.
I had to make a few not-obviously related changes to the
lib/Makefile.local to make this work: libnotmuch_modules is defined
with := and used in place of $^
(cherry picked from commit 014bf85b1c06ff49be2bde5a26433d2cf376cf70)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.local | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Makefile.local b/lib/Makefile.local index 43190231..4676504c 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -36,7 +36,7 @@ LIBRARY_SUFFIX = so LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX) SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR) LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE) -LIBRARY_LINK_FLAG = -shared -Wl,-soname=$(SONAME) +LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) ifeq ($(LIBDIR_IN_LDCONFIG),1) ifeq ($(DESTDIR),) LIBRARY_INSTALL_POST_COMMAND=ldconfig @@ -66,13 +66,20 @@ libnotmuch_cxx_srcs = \ $(dir)/query.cc \ $(dir)/thread.cc -libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o) +libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o) $(dir)/libnotmuch.a: $(libnotmuch_modules) $(call quiet,AR) rcs $@ $^ -$(dir)/$(LIBNAME): $(libnotmuch_modules) - $(call quiet,CXX $(CXXFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ +$(dir)/$(LIBNAME): $(libnotmuch_modules) notmuch.sym + echo $(libnotmuch_modules) + $(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ + +notmuch.sym: lib/notmuch.h + gcc -aux-info notmuch.aux $< + printf "{\nglobal:\n" > notmuch.sym + sed -n 's/.*\(notmuch_[a-z_]*\) (.*/\t\1;/p' notmuch.aux >> notmuch.sym + printf "local: *;\n};\n" >> notmuch.sym $(dir)/$(SONAME): $(dir)/$(LIBNAME) ln -sf $(LIBNAME) $@ @@ -96,4 +103,4 @@ install-$(dir): $(dir)/$(LIBNAME) $(LIBRARY_INSTALL_POST_COMMAND) SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs) -CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a +CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME) $(dir)$(LIBNAME) libnotmuch.a notmuch.aux notmuch.sym |