From: david@tethera.net
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: [PATCH 1/2] libnotmuch: add linker script to declare only notmuch_* symbols as global.
Date: Tue, 21 Jun 2011 22:08:42 -0300 [thread overview]
Message-ID: <1308704923-14748-2-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1308704923-14748-1-git-send-email-david@tethera.net>
From: David Bremner <bremner@debian.org>
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 $^
---
lib/Makefile.local | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 4319023..4676504 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
--
1.7.5.3
next prev parent reply other threads:[~2011-06-22 1:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-22 1:08 david
2011-06-22 1:08 ` david [this message]
2011-06-22 1:08 ` [PATCH 2/2] remove Xapian exceptions symbols from libnotmuch1.symbols david
2011-06-22 2:05 ` hiding xapian symbols Daniel Kahn Gillmor
2011-06-22 2:57 ` David Bremner
2011-06-22 12:02 ` [PATCH] tests: add a test for symbol hiding side effects david
2011-06-23 10:24 ` David Bremner
2011-06-23 22:26 ` Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308704923-14748-2-git-send-email-david@tethera.net \
--to=david@tethera.net \
--cc=bremner@debian.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).